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
Answers were Sorted based on User's Feedback
Code for 1>"ascii to string" 2>"string to ascii"
1 Answers Aricent, Global Logic,
write a c program to Create a mail account by taking the username, password, confirm password, secret_question, secret_answer and phone number. Allow users to register, login and reset password(based on secret question). Display the user accounts and their details .
main() { int i = 257; int *iPtr = &i; printf("%d %d", *((char*)iPtr), *((char*)iPtr+1) ); }
C statement to copy a string without using loop and library function..
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.
What is the subtle error in the following code segment? void fun(int n, int arr[]) { int *p=0; int i=0; while(i++<n) p = &arr[i]; *p = 0; }
write a c program to print magic square of order n when n>3 and n is odd?
#define a 10 void foo() { #undef a #define a 50 } int main() { printf("%d..",a); foo(); printf("%d..",a); return 0; } explain the answer
typedef struct error{int warning, error, exception;}error; main() { error g1; g1.error =1; printf("%d",g1.error); }
main() { int i; i = abc(); printf("%d",i); } abc() { _AX = 1000; }
code of a program in c language that ask a number and print its decremented and incremented number.. sample output: input number : 3 321123
main() { char *p="hai friends",*p1; p1=p; while(*p!='\0') ++*p++; printf("%s %s",p,p1); }