언어/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;
}