Which command is more efficient?
*(ptr+1) or ptr[1]
Answer Posted / poornima
If ptr is declared as a pointer like int *ptr; *(ptr+1) is
more efficient.
If ptr is declared as an array like int ptr[20]; ptr[1] is
more efficient.
So, it depends upon how we r declaring ptr as a pointer or
as an array.
Is This Answer Correct ? | 1 Yes | 3 No |
Post New Answer View All Answers
What are terms in math?
Which is the best website to learn c programming?
#define PRINT(int) printf("int = %d ",int) main() {< BR> intx,y,z; x=03;y=02;z=01; PRINT(x^x); z<<=3;PRINT(x); y>>=3;PRINT(y); }
write a c program to find the sum of five entered numbers using an array named number
What is the use of bit field?
Why doesn't C support function overloading?
main() { struct s1 { char *str; struct s1 *ptr; }; static struct s1 arr[] = { {"Hyderabad",arr+1}, {"Bangalore",arr+2}, {"Delhi",arr} }; struct s1 *p[3]; int i; < BR> for(i=0;i<=2;i++) p[i] = arr[i].ptr; printf("%s ",(*p)->str); printf("%s ",(++*p)->str); printf("%s ",((*p)++)->str); }
Explain the red-black trees?
Write a C program in Fibonacci series.
FILE *fp1,*fp2; fp1=fopen("one","w") fp2=fopen("one","w") fputc('A',fp1) fputc('B',fp2) fclose(fp1) fclose(fp2)} a.error b. c. d.
How to write a program for machine which is connected with server for that server automatically wants to catch the time for user of that machine?
What is a dynamic array in c?
How can I display a percentage-done indication that updates itself in place, or show one of those twirling baton progress indicators?
What is the maximum no. of arguments that can be given in a command line in C.?
Why c is called procedure oriented language?