000-hello_world
Learning Objectives
- What happens when you type
gcc main.c
- What is an entry point
- What is
main
- How to print text using
printf
,puts
andputchar
- How to get the size of a specific type using the unary operator
sizeof
- How to compile using
gcc
- What is the default program name when compiling with
gcc
- What is the official C coding style and how to check your code with
betty-style
- How to find the right header to include in your source code when using a standard library function
- How does the
main
function influence the return value of the program
Solutions
0-preprocessor
#!/bin/bash
gcc -o c $CFILE -E
1-compiler
#!/bin/bash
gcc -c $CFILE
2-assembler
#!/bin/bash
gcc -S $CFILE
3-name
#!/bin/bash
gcc -o cisfun $CFILE
4-puts.c
#include <stdio.h>
/**
* main - Entry point
*
* Return: Always 0 (Success)
*/
int main(void)
{
puts("\"Programming is like building a multilingual puzzle");
return (0);
}
5-printf.c
#include <stdio.h>
/**
* main - Entry point
*
* Return: Always 0 (Success)
*/
int main(void)
{
printf("with proper grammar, but the outcome is a piece of art,\n");
return (0);
}
6-size.c
#include <stdio.h>
/**
* main - Entry point
*
* Return: Always 0 (Success)
*/
int main(void)
{
int a;
long int b;
long long int c;
char d;
float f;
printf("Size of a char: %lu byte(s)\n", (unsigned long)sizeof(d));
printf("Size of an int: %lu byte(s)\n", (unsigned long)sizeof(a));
printf("Size of a long int: %lu byte(s)\n", (unsigned long)sizeof(b));
printf("Size of a long long int: %lu byte(s)\n", (unsigned long)sizeof(c));
printf("Size of a float: %lu byte(s)\n", (unsigned long)sizeof(f));
return (0);
}
README.md
To create a readme.md file just
echo ‘repo description here’ > README.md
If you have any questions please leave it on the comment box bellow.
#Complete the advance task here > https://scisiz.com/low_level_programming-part-2/