44.what is the difference between strcpy() and memcpy()
function?
45.what is output of the following statetment?
46.Printf(“%x”, -1<<4); ?
47.will the program compile?
int i;
scanf(“%d”,i);
printf(“%d”,i);
48.write a string copy function routine?
49.swap two integer variables without using a third
temporary variable?
50.how do you redirect stdout value from a program to a file?
51.write a program that finds the factorial of a number
using recursion?
Answers were Sorted based on User's Feedback
sorry... I made a mistake in the previous 51.answer
i am very sorry...
the solution for recursion is...
long factorial(long n){
return (n==0 || n==1)?1:n * factorial(n-1);
}
| Is This Answer Correct ? | 3 Yes | 0 No |
Answer / sachin patil
44. strcpy copy the string while memcpy copy the memory
contains of locations.
46.fffffff0
49. int a = 5;
int b = 10;
a = a+b;
b = a-b;
a = a-b;
| Is This Answer Correct ? | 2 Yes | 0 No |
51.factorial of a number using recursion
long factorial(long n){
return (n==0 || n==1)?1:n*n-1;
}
| Is This Answer Correct ? | 0 Yes | 2 No |
for(i=1;i>0;i++); printf("i=%d",i); what will be the answer????
what are the uses of structure?
What is main void in c?
Explain the bubble sort algorithm.
void main(int n) { if(n==0) return; main(--n); printf("%d ",n); getch(); } how it work and what will be its output...............it any one know ans plz reply
What is scanf () in c?
how to calculate the time complexity of a given algorithm? pls give exaples..mainly for the coplexities such as O(log n),O(n log n)...
Explain About fork()?
Why is c not oop?
Write a program to find the number of times that a given word(i.e. a short string) occurs in a sentence (i.e. a long string!). Read data from standard input. The first line is a single word, which is followed by general text on the second line. Read both up to a newline character, and insert a terminating null before processing. Typical output should be: The word is "the". The sentence is "the cat sat on the mat". The word occurs 2 times.
You have given 2 array. You need to find whether they will create the same BST or not. For example: Array1:10 5 20 15 30 Array2:10 20 15 30 5 Result: True Array1:10 5 20 15 30 Array2:10 15 20 30 5 Result: False One Approach is Pretty Clear by creating BST O(nlogn) then checking two tree for identical O(N) overall O(nlogn) ..we need there exist O(N) Time & O(1) Space also without extra space .Algorithm ?? DevoCoder guest Posted 3 months ago # #define true 1 #define false 0 int check(int a1[],int a2[],int n1,int n2) { int i; //n1 size of array a1[] and n2 size of a2[] if(n1!=n2) return false; //n1 and n2 must be same for(i=0;i<n1-1;i++) { if( !( (a1[i]>a1[i+1]) && (a2[i]>a2[i+1]) ) ) return false; } return true;//assumed that each array doesn't contain duplicate elements in themshelves }
What is a volatile keyword in c?