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 |
void main() { int i=5; printf("%d",i++ + ++i); }
Given only putchar (no sprintf, itoa, etc.) write a routine putlong that prints out an unsigned long in decimal.
6 Answers Fusion Systems GmbH,
void main() { int k=ret(sizeof(float)); printf("\n here value is %d",++k); } int ret(int ret) { ret += 2.5; return(ret); }
#include<stdio.h> main() { char s[]={'a','b','c','\n','c','\0'}; char *p,*str,*str1; p=&s[3]; str=p; str1=s; printf("%d",++*p + ++*str1-32); }
main() { register int a=2; printf("Address of a = %d",&a); printf("Value of a = %d",a); }
Derive expression for converting RGB color parameters to HSV values
Is the following code legal? typedef struct a aType; struct a { int x; aType *b; };
main() { printf("%x",-1<<4); }
Write a program that reads a dynamic array of 40 integers and displays only even integers
void main() { int i; char a[]="\0"; if(printf("%s\n",a)) printf("Ok here \n"); else printf("Forget it\n"); }
void func1(int (*a)[10]) { printf("Ok it works"); } void func2(int a[][10]) { printf("Will this work?"); } main() { int a[10][10]; func1(a); func2(a); } a. Ok it works b. Will this work? c. Ok it worksWill this work? d. None of the above
Give a very good method to count the number of ones in a 32 bit number. (caution: looping through testing each bit is not a solution)