Posts
 
Reputation
Joined
Last Seen
0 Reputation Points
Unknown Quality Score

No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.

0 Endorsements
~305 People Reached
Favorite Forums
Favorite Tags
c x 10
Member Avatar for califguy

Hey, What I am looking to is this: Receive 32 bytes of data from serial port into an array. ( This I have done already) Now based on say the second byte in the first 32 bytes, i will know the size of the entire packet I need to receive, …

Member Avatar for rpiper138
0
109
Member Avatar for califguy

[code=c] #include<stdio.h> #include<stdlib.h> main() { char a[32],*a1,b[64],*b1; a1=&a[0]; b1=&b[0]; a1="hellohellohellohellohellohello" ; printf("\n contents of a1: %s\n",a1); int i =0; for(i=0;i<=31;i++) { printf("%c",a[i]); } } [/code] So why does printf ("%s",a1) work correctly while printf("%c",a[i]) display junk ? Since a1 points to a[0], shouldn'it it display the same values ?

Member Avatar for califguy
0
112
Member Avatar for califguy

hi guys, I have a simple question and I am new to c, Would appreciate any advise I could get. Here's the doubt. [code=c] main() { char a[10],*a1,b[10],*b1; a1=&a[0]; b1=&b[0]; int x=0; for (x=0;x<=1-;x++0) { *a1++=*b1++; } } [/code] Basically if I had a string in b[10] it would get …

Member Avatar for califguy
0
84