#include
#include
char s[80]
int i;
int main (){
strcpy(s, "hi there");
i=0;
while(s [i] !='&'){
i ++;
}
i ++;
while(s[i] !='&'){
i++;
}
printf(" i=%d\n",i);
}
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
VulpesRank #55 · 29.2K reputationPosted Aug 12, 2012, 4:30 PM EDT
On the second point, there are number of issues but this should compile and print something sensible:
VulpesRank #55 · 29.2K reputationPosted Aug 12, 2012, 4:13 PM EDT
If you don't do this, then you'll get a silly answer as the while loops keep on iterating until they find a '&' in memory.
sami sam39 reputationPosted Aug 12, 2012, 4:22 PM EDT
sami sam39 reputationPosted Aug 12, 2012, 4:25 PM EDT