Given a C code, What sort of error would you expect to see? At what stage of building the program does this error occur?
$10-30 USD
Completed
Posted about 6 years ago
$10-30 USD
Paid on delivery
Consider the following code:
#include <stdio.h>
char * Flip_A_Coin(int x)
{
if (x%2 == 0)
return("heads");
else
return("tails");
}
Assume that this code is stored in a file named coin1.c and compiled as follows:
ahoover@video> gcc -o coin1 coin1.c
What sort of error would you expect to see? At what stage of building the program
does this error occur?
Hi there, I went through the initial description of the project. I'd like to have further details on the code and the topic of this subject. Let me know if you are interested.
$ gcc -o coin1 coin1.c
/usr/lib/gcc/x86_64-redhat-linux/7/../../../../lib64/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
this code will compile correctly and this function will return the address of the first letter of one of the two options depend on the function argument . both of the words will be written in part of NVM memory and or code will deal only with their address and we can read them but the problem will occur if we try in any line of our code to write in those addresses ..
I have a big experience in C and work in a lot of project with it . I can give you a professional and readable code which will be easy to but any change on it if you want to add new features
Return type is char.
And you return string.
I hope it will work.
Try and see what happen let me know if not work.
Relevant Skills and Experience
C,C#,PHP