write a function which accept two numbers from main() and
interchange them using pointers?
Answer Posted / sarathi
#include<stdio.h>
main()
{
int *p,*q;
*p=10;
*q=20
void swap(int &p,int &q);
}
void swap(int *x,int *y);
{
int *tmp;
*tmp=*x;
*x=*y;
*y=*x;
printf("%d,%d",*x,*y);
}
| Is This Answer Correct ? | 5 Yes | 4 No |
Post New Answer View All Answers
How can I read and write comma-delimited text?
write an interactive C program that will encode or decode a line of text.To encode a line of text,proceed as follows. 1.convert each character,including blank spaces,to its ASCII equivalent. 2.Generate a positive random integer.add this integer to the ASCII equivalent of each character.The same random integer will be used for the entire line of text. 3.Suppose that N1 represents the lowest permissible value in the ASCII code,and N2 represents the highest permissible value.If the number obtained in step 2 above(i.e.,the original ASCII equivalent plus the random integer)exceeds N2,then subtract the largest possible multiple of N2 from this number,and add the remainder to N1.Hence the encoded number will always fall between N1 and N2,and will therefore always represent some ASCII character. 4.Dislay the characters that correspond to the encoded ASCII values. The procedure is reversed when decoding a line of text.Be certain,however,that the same random number is used in decodingas was used in encoding.
Are pointers integers in c?
Explain what is a pragma?
What is #include cctype?
What is array of structure in c?
How important is structure in life?
Why do we use static in c?
What is pass by reference in functions?
while initialization of array why we use a[][2] why not a[2][]...?
What is a substring in c?
What does c mean in basketball?
How to throw some light on the b tree?
Differentiate between a for loop and a while loop? What are it uses?
Write a program in c to replace any vowel in a string with z?