추가할 임시 코드 [ 계산기 ]
언어/c언어2017. 7. 30. 14:03
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# define LEN 40
typedef struct FourOpe
{
char tmp_LeftNumber[LEN];
char tmp_RightNumber[LEN];
char tmp_Ope;
int LeftValue;
int RightValue;
} FourOpe, *PTR_FourOpe;
PTR_FourOpe createNode()
{
PTR_FourOpe node = (PTR_FourOpe)malloc(sizeof(FourOpe));
if (node == NULL) exit(1);
else {
memset(node, 0, sizeof(FourOpe)); // <- Initiallize
return node;
}
} // end of PTR_FourOpe function
int main(int argc, char* argv[])
{
if (argc != 2)
{
printf("Usage : ./filname \"21 + 22\"\n");
exit(1);
}
else // argc == 2
{
PTR_FourOpe startNode = NULL;
startNode = createNode();
free(startNode);
}
return 0;
}
'언어 > c언어' 카테고리의 다른 글
자료형(sizeof) (0) | 2017.08.08 |
---|---|
오버 플로우 됬는지 확인하는 코드 (c언어) (0) | 2017.07.30 |
별찍기 (0) | 2017.07.13 |
c언어 시저 코드 (0) | 2017.07.04 |
네이버 답변 (0) | 2017.07.01 |