C言語をやりたいんですが
■ このスレッドは過去ログ倉庫に格納されています
1デフォルトの名無しさん
2007/12/23(日) 02:35:09 まずなにやったらいいの?
72 ◆nullpop./c
2008/01/26(土) 08:29:26 >>1おはよう。できたかな?
模範解答を示す。
長いので、スレをまたぐが。
#include <windows.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
typedef struct tab_sex_stack{
char *data;
int size;
struct tab_sex_stack *tugi;
} STACK;
STACK *o721 = NULL;
模範解答を示す。
長いので、スレをまたぐが。
#include <windows.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
typedef struct tab_sex_stack{
char *data;
int size;
struct tab_sex_stack *tugi;
} STACK;
STACK *o721 = NULL;
73 ◆nullpop./c
2008/01/26(土) 08:29:48 int pop(void *data){
STACK *sp;
int size;
if (data == NULL) return -4;
if (o721 == NULL) {
return 0;
}
size = o721->size;
memcpy(data, o721->data,size);
sp = o721->tugi;
free(o721->data);
free(o721);
o721 = sp;
return size;
}
int push(void *data, int size){
STACK *sp;
if (data == NULL || size <= 0) return -4;
sp = o721;
o721 = malloc(sizeof(STACK));
if (o721 == NULL) return 0;
o721->data = malloc(size);
memcpy(o721->data, data, size);
o721->size = size;
o721->tugi = sp;
return 32;
}
STACK *sp;
int size;
if (data == NULL) return -4;
if (o721 == NULL) {
return 0;
}
size = o721->size;
memcpy(data, o721->data,size);
sp = o721->tugi;
free(o721->data);
free(o721);
o721 = sp;
return size;
}
int push(void *data, int size){
STACK *sp;
if (data == NULL || size <= 0) return -4;
sp = o721;
o721 = malloc(sizeof(STACK));
if (o721 == NULL) return 0;
o721->data = malloc(size);
memcpy(o721->data, data, size);
o721->size = size;
o721->tugi = sp;
return 32;
}
74 ◆nullpop./c
2008/01/26(土) 08:30:31 main(){
auto char eros[200];
int meko;
int gane;
DWORD timmer = GetTickCount();
push("aho", 4);
push("baka", 5);
gane = 0721;
push(&gane, 4);
pop(&meko);
printf("%d\n\n", meko);
pop(eros);
puts(eros);
pop(eros);
puts(eros);
pop(eros);
puts(eros);
/* EOF */
auto char eros[200];
int meko;
int gane;
DWORD timmer = GetTickCount();
push("aho", 4);
push("baka", 5);
gane = 0721;
push(&gane, 4);
pop(&meko);
printf("%d\n\n", meko);
pop(eros);
puts(eros);
pop(eros);
puts(eros);
pop(eros);
puts(eros);
/* EOF */
■ このスレッドは過去ログ倉庫に格納されています
ニュース
- こども家庭庁、2026年から“独身税”を開始、年収200万なら年4200円、年収400万なら年7800円 ★5 [お断り★]
- 伊東市長選、田久保氏の落選確実 元市議の杉本氏と元市長の小野氏が激しく競り合う [蚤の市★]
- サナエノミクスについて力説 積極的な財政出動で「所得増える 消費マインド上がる 税収増える」片山さつき財務大臣 ★2 [少考さん★]
- 中国軍機のレーダー照射1週間 駆け引き続く 中国、米のレッドライン模索 日本、米以外の同志国とも連携探る 米は対立から距離置く [ぐれ★]
- B’z東京ドーム公演で後ろの客が大熱唱…「B’zの歌声に集中できない」注意すると笑いながら反論されモヤモヤ [muffin★]
- 【静岡】伊東市長選、田久保氏の敗北確実 元市議と元職が激戦 [ぐれ★]
- 【実況】博衣こよりのえちえちボンバーマン大会🧪★4
- 【実況】博衣こよりのえちえちボンバーマン大会🧪★5
- 【朗報】安倍晋三、冥界から「IRIS_OUT」のレゼダンスを披露 [884040186]
- あぼーん
- 【悲報】『山に上る』などの隠悟、ガチで取り締まりか!?wwwwwwWWwwwwwwWw [793833473]
- 【速報】伊東市長選、田久保氏が敗北確実wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww [812874503]
