E D R , A S I H C RSS

간단한C언어문제

내는 C.
C 를 ** 배 .
** : 바란.


~cpp 
Spec  .
16Bit  Windows
ANSI C를  는 Compiler (C90)

, .

1.
~cpp 
#include <stdio.h>

main(){
int i;

	for(i=0; i<10; i++){	// 딴 : {는 for문 뒤  . -_-. 내리는    .( .)
		printf("%d", i);
	}
}
Note:
-
. -_- -

. 메 . -yahar

. -

C ;;; 러는 return int warnning ;; -
. C90 . , .
, . -yuhar
-

2.
~cpp 
#include <stdio.h>

main(){
int a, b;
double c;

	a = 30000;
	b = 30000;

	c = a + b;

	printf("%f", c);
}
Note:
-
. 는 %f %d 바뀌면 더 .-
signed int a b를 더면 (65535/2) - . (-65536/2)+((30000+30000)-(65536/2-1)) <- 제대로 설명을 못하겠다;;; -
-

3.
~cpp 
#include <stdio.h>

main(){
const char *a;
char *b, msg[]="test code";

	a = msg;
	b = a;

	puts(msg);
	puts(msg);
}
Note:
-
. &a 만 변 (;;)-
. 문 b=a; . const char * char * . 러. -
-

4.
~cpp 
//    며,  .
#include <stdio.h>

main(){
float num;
char data[]="123.12";

	num = atof(data);

	printf("%f", num);
}
Note:
-
. f s. -
. atof float변 만, atof 더를 int return. , num 123 . ANSI C99 . -
-

5.
~cpp 
main(){
int a, b, c;

	a = 0010;
	b = 0200;
	c = 2000;

	printf("a=%d b=%d c=%dn", a, b, c);
}
Note:
-
. 0 . -
. 0 면 8 . 0x <- 16진수 -
-

6.
~cpp 
#include <stdio.h>
#include <ctype.h>

main(){
char ss[] = "A2 문";
int i;

	puts(ss);

	for(i=0; ss[i]; i++){
		printf("i=%d %4x(%4d) ", i, ss[i], ss[i]);
		if(isdigit(ss[i]))	puts("");
		else			puts("");
	}
}
Note:
-
. ss[] "문"란 는 isdigit . (.) isdigit 면 unsigned char . 본 char signed. -
-

7.
~cpp 
#include <stdio.h>

main(){
int i;

	while(scanf("%d", &i), i)
		printf("%d", i);
}
Note:
-
. . -
. , . -
-

8.
~cpp 
#include <stdio.h>

main(){
char *p;

	gets(p);
	puts(p);
}
Note:
-
. . -
. . -
-

9.
~cpp 
// main.h
#define NUM 100

struct a {
	int num1;
	int num2;
};

// main.c
#include "main.h"
#define NUM 200

main(){
struct a test;

	test.num1 = 100;
	test.num2 = 200;

	printf("%d", test.num1+test.num2);
}
Note:
-
. -
. NUM 2번 define . define 200 . -
-

10.
~cpp 
//    linking
//main1.c
static int a = 100;

int mul(int num)
{
	printf("a = %d", a);
	return num*num;
}

//main2.c
main(){
exturn int a;

	printf("a = %d");
	printf("%d", mul(100));
}
Note:
-
. -
. static C++ private . . -
-

11.
~cpp 
//    linking
// 1.c
main(){
double a, b;

	a = 1234.1234;
	b = 123.123;

	printf("%f", mul(a, b));
}

// 2.c
double mul(double a, double b){
	return a*b;
}
Note:
-
. -
. return int 바뀐. return . -
-

12.
~cpp 
main(){

Note:
-
-

100번 만 내. -_-
11번 .

? --
. --
. ^^ --
. . --

. 만들 -

;; -

----

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:28:38
Processing time 0.0228 sec