Ask a question from expert

Ask now

C Programming Language Assignment

44 Pages2042 Words197 Views
   

Added on  2021-03-18

C Programming Language Assignment

   Added on 2021-03-18

BookmarkShareRelated Documents
1Click to edit Master text stylesSecond levelThird levelFourth levelFifth levelEECS 2031Software ToolsModule 5 – Introduction to C
C Programming Language Assignment_1
2TextbookThe C Programming Language (2nd edition)by Brian Kernighan and Dennis RitchiePrentice Hall Software Series
C Programming Language Assignment_2
3C vs. JavaJava-like (actually Java has a C-like syntax), some differencesNo garbage collectionNo classesNo exceptions (try ... catch)No String typePointers
C Programming Language Assignment_3
4First C Program (first.c)#include <stdio.h>main() {printf(“hello, world \n”);}Note: #include <filename.h> replaces the line by the actual file before compilation starts.
C Programming Language Assignment_4
5Basic I/OEvery program has a standard input and a standard output.By default, keyboard and monitor, respectivelyInput functionsOutput functionsscanf()printf()getchar()putchar()fgets()fputs()
C Programming Language Assignment_5
6Output is easy... (celsius.c)Most of the time, use printf()Very similar to JavaSee Chapter 7 in the textbookReturns the number of characters printedCan also use putchar() for a single character
C Programming Language Assignment_6
7Input is more complicatedSeveral functions for input should neverbe used because they are unsafeThey are still in the standard library because a lot of code out there uses themAvoid using gets()as well as scanf()for stringsRecommended way to read input: getchar()or fgets()+ sscanf()
C Programming Language Assignment_7
8getchar()To read one character at a time from the standard input (the keyboard by default):int getchar(void)Returns the next input character each time it is calledReturns EOF when it encounters end of file.EOF input: Ctrl-D (Unix) or Ctrl-Z (Windows).
C Programming Language Assignment_8

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents
C program code:.
|3
|530
|57

Hostel Management System
|25
|1266
|447

Common Programming Errors and Security Measures
|9
|2871
|70

Asking User for numbersof Students
|13
|771
|61

Questions on Stack Program
|11
|1305
|31

Data Type And String in Python Report
|9
|2149
|24