What's wrong with "char *p; *p = malloc(10);"?
Answers were Sorted based on User's Feedback
Answer / clay
Here,
After char *p;
since pointer p is not initialized it is pointing at some
unknown location.
In the next step, the address of the memory allocated by
malloc() is stored at some garbage location pointed by p.
Here p is never initialized or never assigned any value.
| Is This Answer Correct ? | 0 Yes | 3 No |
Write a program to produce the following output: 1 2 3 4 5 6 7 8 9 10
c program to subtract between two numbers without using '-' sign and subtract function.
what is a headerfile?and what will be a program without it explain nan example?
Write a programe print the sum of series 0,1,2,.....10
void main() { int *ptr; ptr = (int *) 0x400 ; printf("ptr=%d",ptr); } output?
Study the code: void show() main() { show(); } void show (char *s) { printf("%sn",s); } What will happen if it is compiled & run on an ANSI C Compiler? A)It will compile & nothing will be printed when it is executed B)it will compile but not link C)the compiler will generate an error D)the compiler will generate a warning
Write an implementation of “float stringToFloat(char *str).” The code should be simple, and not require more than the basic operators (if, for, math operators, etc.). • Assumptions • Don’t worry about overflow or underflow • Stop at the 1st invalid character and return the number you have converted till then, if the 1st character is invalid return 0 • Don’t worry about exponential (e.g. 1e10), instead you should treat ‘e’ as an invalid character • Write it like real code, e.g. do error checking • Go though the string only once • Examples • “1.23” should return 1.23 • “1a” should return 1 • “a”should return 0
write a C program : To find out the number of identical words in two files . the file name should be taken as command line argument .
The % symbol has a special use in a printf statement. Explain how would you place this character as part of the output on the screen?
If the size of int data type is two bytes, what is the range of signed int data type?
Do you know the use of 'auto' keyword?
write a c program to remove all the duplicate characters in a string and replace with single character? ex:-input- AAABBBCCC output- ABC