char inputString[100] = {0};
To get string input from the keyboard which one of the
following is better?
1) gets(inputString)
2) fgets(inputString, sizeof(inputString), fp)
Answer / susie
Answer : & Explanation:
The second one is better because gets(inputString) doesn't
know the size of the string passed and so, if a very big
input (here, more than 100 chars) the charactes will be
written past the input string. When fgets is used with stdin
performs the same operation as gets but is safe.
| Is This Answer Correct ? | 2 Yes | 0 No |
write a origram swaoing valu without 3rd variable
Write a C program to add two numbers before the main function is called.
what will be the output of this program? void main() { int a[]={5,10,15}; int i=0,num; num=a[++i] + ++i +(++i); printf("%d",num); }
Program to Delete an element from a doubly linked list.
4 Answers College School Exams Tests, Infosys,
Given only putchar (no sprintf, itoa, etc.) write a routine putlong that prints out an unsigned long in decimal.
6 Answers Fusion Systems GmbH,
main() { char *p="hai friends",*p1; p1=p; while(*p!='\0') ++*p++; printf("%s %s",p,p1); }
how can u draw a rectangle in C
53 Answers Accenture, CO, Codeblocks, Cognizant, HCL, Oracle, Punjab National Bank, SAP Labs, TCS, University, Wipro,
struct Foo { char *pName; }; main() { struct Foo *obj = malloc(sizeof(struct Foo)); clrscr(); strcpy(obj->pName,"Your Name"); printf("%s", obj->pName); } a. Your Name b. compile error c. Name d. Runtime error
to remove the repeated cahracter from the given caracter array. i.e.., if the input is SSAD output should of SAD
main() { char i=0; for(;i>=0;i++) ; printf("%d\n",i); }
All the combinations of prime numbers whose sum gives 32
main() { { unsigned int bit=256; printf("%d", bit); } { unsigned int bit=512; printf("%d", bit); } } a. 256, 256 b. 512, 512 c. 256, 512 d. Compile error