Watch the video below
Introduction to C programming
ATTEMPT THE TASKS BELOW
Note:
- All Solutions Must be Pushed to your Github repository - "
as stated in the questions" (Remember to clone this repository in your local terminal)
All Solutions Must be in the Directory - "
as stated in the questions" and there should be a README.md file in this directory.- Execute all Scripts using the command: chmod u+x <filename>
- Take note of the filename of each task.
- You are free to use any of the following editors:
vi
,vim
,emacs.
Use the
Betty comment
style.
Answer:
#!/bin/bash gcc -E $CFILE -o c | |
Answer:
#!/bin/bash
gcc -c $CFILE
Answer:
#!/bin/bash
gcc -S $CFILE
Answer:
#!/bin/bash
gcc $CFILE -o cisfun
Answer: | |
#include <stdio.h> /** | |
** main - print the string in the put function | |
* | |
** Description: using the main function | |
** this program prints "Programming is like building a multilingual puzzle | |
** Return: 0 | |
**/ | |
int main(void) | |
{ | |
puts("\"Programming is like building a multilingual puzzle"); | |
return (0); | |
} |
#include <stdio.h> /** | |
**main - Entry point | |
* | |
**Return: retun 1 after program execution | |
**/ | |
int main(void) | |
{ | |
printf("with proper grammar, but the outcome is a piece of art,\n"); | |
return (0); | |
} |
Answer:
**main - Entry point | ||
* | ||
**Return: Always 0 (Success) | ||
**/ | ||
int main(void) | ||
{ | ||
printf("Size of a char: %d byte(s)\n", sizeof(char)); | ||
printf("Size of an int: %d byte(s)\n", sizeof(int)); | ||
printf("Size of a long int: %d byte(s)\n", sizeof(long int)); | ||
printf("Size of a long long int: %d byte(s)\n", sizeof(long long int)); | ||
printf("Size of a float: %d byte(s)\n", sizeof(float)); | ||
return (0); | ||
} |
#!/bin/bash
gcc -S -masm=intel $CFILE
Answer:
#include <stdio.h> #include <unistd.h> | |
/** | |
**main - Entry point | |
* | |
**description: 'to display a string using the write method' | |
* | |
**Return: Always 0 (Success) | |
**/ | |
int main(void) | |
{ | |
write(2, "and that piece of art is useful\" - Dora Korpar, 2015-10-19\n", 59); | |
return (1); | |
} |
1 Comments
I hope this post was useful to you.
ReplyDelete