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 |
main() { void swap(); int x=10,y=8; swap(&x,&y); printf("x=%d y=%d",x,y); } void swap(int *a, int *b) { *a ^= *b, *b ^= *a, *a ^= *b; }
writte a c-programm to display smill paces
write a c-program to display the time using FOR loop
char *someFun() { char *temp = “string constant"; return temp; } int main() { puts(someFun()); }
main() { int i; printf("%d",scanf("%d",&i)); // value 10 is given as input here }
write a c-program to find gcd using recursive functions
source code for delete data in array for c
What is full form of PEPSI
Write a routine that prints out a 2-D array in spiral order
void main() { int i=5; printf("%d",i++ + ++i); }
main() { char p[ ]="%d\n"; p[1] = 'c'; printf(p,65); }
#include<stdio.h> main() { register i=5; char j[]= "hello"; printf("%s %d",j,i); }