Which version do you prefer of the following two,
1) printf(“%s”,str); // or the more curt one
2) printf(str);
Answer / susie
Answer : & Explanation:
Prefer the first one. If the str contains any format
characters like %d then it will result in a subtle bug.
Is This Answer Correct ? | 3 Yes | 0 No |
All the combinations of prime numbers whose sum gives 32
void main() { static int i=5; if(--i){ main(); printf("%d ",i); } }
#include<stdio.h> main() { register i=5; char j[]= "hello"; printf("%s %d",j,i); }
main() { char *p; printf("%d %d ",sizeof(*p),sizeof(p)); }
Write a c program to search an element in an array using recursion
main() { char *p = "hello world"; p[0] = 'H'; printf("%s", p); } a. Runtime error. b. “Hello world” c. Compile error d. “hello world”
void main() { int *mptr, *cptr; mptr = (int*)malloc(sizeof(int)); printf(“%d”,*mptr); int *cptr = (int*)calloc(sizeof(int),1); printf(“%d”,*cptr); }
There are 21 people in a room. They have to form groups of 3 people each. How many combinations are possible? Write a C program to print the same.
write a program to find out roots of quadratic equation "x=-b+-(b^2-4ac0^-1/2/2a"
# include<stdio.h> aaa() { printf("hi"); } bbb(){ printf("hello"); } ccc(){ printf("bye"); } main() { int (*ptr[3])(); ptr[0]=aaa; ptr[1]=bbb; ptr[2]=ccc; ptr[2](); }
main() { char *p = “ayqm”; char c; c = ++*p++; printf(“%c”,c); }
#include<stdio.h> main() { struct xx { int x=3; char name[]="hello"; }; struct xx *s=malloc(sizeof(struct xx)); printf("%d",s->x); printf("%s",s->name); }