language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include<stdio.h>
void main()
{
int i,n,flag=0,pass,temp;
int num[50];
printf("no of elements?");
scanf("%d",&n);
printf("Enter the elements");
for(i=1;i<=n;i++)
{
scanf("%d",&num[i]);
}
for(pass=1;pass<=n-1;pass++)
{
for(i=1;i<=n-1;i++)
{
if(num[i]>num[i+1])
... |
C | #include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <stdarg.h>
#include "Error.h"
#include "../Commons.h"
/* Represents error occurence while compiling .as file */
typedef struct
{
ErrorCode code; /* Error code of the error */
int line_num; /* Line number whe... |
C | /*程序填空,不要改变与输入输出有关的语句。
输入一个正整数repeat (0<repeat<10),做repeat次下列运算:
给定平面任意两点坐标 (x1, y1) 和 (x2, y2),求这两点之间的距离(保留2位小数)。
要求定义和调用函数 dist(x1, y1, x2, y2)计算两点间的距离,函数形参x1、y1、x2和y2的类型都是double,函数类型是double。
输入输出示例:括号内是说明
输入
1 (repeat=1)
10 10 (x1=10, y1=10)
200 100 (x2=200, y2=100)
输出
Distance = 210.... |
C | #include<stdio.h>
int res = -1;
long int res1 = -1;
float res2;
int main()
{
int a, b;
printf("enter values of a,b\n");
scanf_s("%d %d", &a, &b);
res = add(a, b);
printf("addition result is %d\n", res);
res = sub(a, b);
printf("subtraction result is %d\n", res);
res1 = mul(a, b);
printf("multiplication result... |
C | #include <stdlib.h>
#include <CUnit/CUnit.h>
#include "main.h"
#include "test.h"
char **targv;
char **arglim;
char *progName;
unsigned int verbose;
void
test_myinput_000(void)
{
char *temp[] = {"-d", "parse.y"};
char buf[512];
int max = 512;
int ret;
targv = temp;
arglim = temp+2;
ret = myinput(bu... |
C | #include <stdio.h>
int main()
{
printf("The datatype int is %ld bytes\n",sizeof(int));
printf("The datatype float is %ld bytes\n",sizeof(int));
printf("The datatype double is %ld bytes\n",sizeof(double));
printf("The datatype char is %ld bytes\n",sizeof(char));
}
|
C | ////
//// Created by shuncs on 19-2-28.
////
//
//#include <stdio.h>
//
//int main(void)
//{
// //每一个元素指向一个常量字符串
// //实质上是一个指针数组
// char *ch[3] = {"123", "ssdddd", "adsdfdfsdsd"};
// //字符串数组直接指向字符常量区的内容
// for(int i=0;i<3;i++)
// {
// printf("%s\n", ch[i]);
// }
//
// //常量字符串指针可以更改指向,但是不能... |
C | #include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
int main()
{
int
}
/*
//7.12 6
int main()
{
int i=0;
char ch;
while((ch=getchar())!='#')
{
if(ch=='e')
{
i++;
}
if(ch=='i')
{
i++;
}
}... |
C | #include <linux/init.h>
#include <linux/fs.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/workqueue.h>
MODULE_AUTHOR("Mike Feng");
/*测试数据结构*/
struct my_data
{
struct work_struct my_work;
int value;
};
struct workqueue_struct *wq=NULL;
stru... |
C | /** @file log.h */
#ifndef __LOG_H_
#define __LOG_H_
typedef struct _log_t {
struct _log_t *prev;
struct _log_t *next;
char *item;
} log_t;
void log_init(log_t *l);
void log_destroy(log_t* l);
void log_push(log_t* l, const char *item);
char *log_search(log_t* l, const char *prefix);
#endif
|
C | #include<stdio.h>
#include<math.h>
/* creating a function so that in the future a function with different arguments but same signature can be used */
double function(double x){
return pow(x,10)-1;
}
/* the method takes a standard in_out function which has both input as well as output to be double*/
double bis... |
C | /* This program finds the minimum number in an array */
#include <stdio.h>
#define SIZE 8
int Minimum(int A[], int n) {
int i;
int min = A[0]; // let the 1st element be the initial min
// inspect the remaining array elements
for (i = 0; i < n; i++)
if (A[i] < min)
min = A[i];
return min;
}
in... |
C | int main() {
int x = 1;
int* y = &x;
int* z = &*y;
assert(*z == 1);
*&x = 3;
assert(*z == 3);
}
|
C | #include "queue.h"
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
int main(void)
{
queueHead* queue;
int i1 = 1;
int i2 = 2;
int i3 = 3;
int i4 = 4;
/*
* Test 1
*/
/* Create queue */
assert(N... |
C | #include <list.h>
linklist* CreateListInHead()
{
linklist *L = NULL;
linklist *tmp = NULL;
int data = 0;
int i = 0;
int NodeCount = 0;
if(NULL != L)
{
free(L);
}
printf("Please input the count that you want:\n");
scanf("%d",&NodeCount);
if(NodeCount <= 0)
{
printf("Create fail!\n");
return L;
}
pr... |
C | #include "keys.h"
#include <GL/freeglut.h>
void setSpecialKeyState(int key, bool state){
//Arrow keys
if ((key >= GLUT_KEY_LEFT) && (key <= GLUT_KEY_DOWN)){
int myKey = (key-GLUT_KEY_LEFT) + KEY_A_LEFT;
//if the key is an arrow key then set the state in the arrow key array
keyData.arrowKeysPressed[myKey] = st... |
C | #include "KeyBoard.h"
void init_KeyBoard()
{
GPIO_InitTypeDef GPIO_InitStructure;
/*************************键盘初始化*****************************/
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOE | RCC_AHB1Periph_GPIOD, ENABLE);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2 | GPIO_Pin_3 | GPIO_Pin_4 | GPIO_Pin_5;
GPIO_InitSt... |
C | #include <stdio.h>
#include <assert.h>
#include <math.h>
#include <stdlib.h>
#include <stdbool.h>
#include <gsl/gsl_matrix.h>
#include <gsl/gsl_vector.h>
#include <gsl/gsl_blas.h>
#define RND (double)rand()/RAND_MAX
#define FMT "%7.3f" //format of print "7 width, 3 digits after comma"
// inspired by Dmitri Fedorovs p... |
C | #include <stdio.h>
#include <stdlib.h>
#define ERROR_FILE_OPEN -3
int main(void)
{
FILE *file;
char c;
file = fopen("x", "w+t");
if (file == NULL)
{
printf("ERROR CREATING/OPENING\n");
exit(ERROR_FILE_OPEN);
}
do {
c = getchar();
fputc(c, file);
fputc(c, stdout);
} while (c != 27);
fclose(file);
... |
C | #include "patchMatch.h"
int*
initialisation(int cols_s, int rows_s, int cols_t, int rows_t)
{
int* nnf = malloc(sizeof(int) * cols_t * rows_t);
srand(time(NULL));
for(int i=0; i<cols_t*rows_t; i++){
nnf[i] = rand()%(cols_s*rows_s);
}
return nnf;
}
int
iteration(Pyramid* source, Pyramid* source_filter,... |
C | #include <stdio.h>
#include <math.h>
struct Ponto2d pontoInicial;
struct Ponto2d pontoFinal;
// Estrutura de dados
struct Ponto2d {
float x;
float y;
};
void lerPontoInicial()
{
// Valor do ponto inicial X
printf("Digite o valor X do ponto inicial: ");
scanf("%f", &pontoInicial.x);
// Valor do ponto in... |
C | /*
** EPITECH PROJECT, 2018
** CPool_2018
** File description:
** Maxence Carpentier
*/
#include <stdlib.h>
#include <stdio.h>
#include "my.h"
char *my_revstr(char *str)
{
int i2 = my_strlen(str) - 1;
char c;
for (int i = 0; i < i2; i++) {
c = str[i];
str[i] = str[i2];
str[i2] = c... |
C | #include "pila.h"
#include "testing.h"
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
//Pruebas unitarias del alumno
void prueba_crear_destruir(){
printf("****Inicio de prueba crear y destruir pila****\n");
pila_t* pila = pila_crear();
print_test("Se creo la pila", true);
pila_destruir(pil... |
C | /*
计算 10000! 的结果并打印
运算时间在1S内
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#define PI 3.14159
#define E 2.718
int factorial_digit(int nMlutply);
int main(void)
{
clock_t t1, t2;//计时器
t1 = clock();
int nResult[40001] = { 0 };//存放结果的数组
int nArrayMax = 40000;//数组尾... |
C | /*********************************************************************
** PROYECTO DE AUTÓMATAS Y LENGUAJES - PRÁCTICA 1
** generacion.c
** AUTORES:
** - Carlos Molinero Alvarado - carlos.molineroa@estudiante.uam.es
** - Rafael Hidalgo Alejo - rafael.hidalgoa@estudiante.uam.es
** ÚLTIMA MODIFICACIÓN: 28 de octubre de... |
C | #pragma once
//BM.h library
#ifndef BM_H
#define BM_H
/* Definitions */
typedef struct {
float **rows;
int r_size; //rows
int c_size; //columns
} BM;
/* Function prototypes */
BM* bm_make(int r_size, int c_size);
/*
The function attempts to construct a Matrix structure, allocating memory for its ... |
C | #include <pthread.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <assert.h>
/* Queue Structures */
typedef struct queue_node_s {
struct queue_node_s *next;
struct queue_node_s *prev;
char c;
} queue_node_t;
typedef struct {
struct queue_node_s *front;
struct queue_node_s *back;
p... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <assert.h>
#include <ctype.h>
#include "main.h"
int main(void)
{
int player, computer, result;
srand((unsigned)time(NULL));
for(;;)
{
player = get_player_choice();
if (player == QUIT)
return 0;
computer ... |
C | /*********************************************************
*
* @Proposit: Aquest fitxer conté el main on está definit
* el cos del jos, és a dir, el menu principal.
* @Autor: Nicole Marie Jimenez Burayag
* @Data creacio: 17/03/2018
* @Data ultima modificacio: 09/05/2018
*
*********************************... |
C | #include "hashMap.h"
#include <assert.h>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
/**
* Allocates a string for the next word in the file and returns it. This string
* is null terminated. Returns NULL after reaching the end of the file.
* @param file
... |
C | #include "holberton.h"
/**
* token - Splits a string
* @str: command enter for the user
* Return: array of each word of the string splited.
*/
char **token(char *str)
{
char *token, **tokencomplete;
int i = 0, j = 1, position = 0;
char delimit[] = " \t\r\n\v\f";
for (i = 0; str[i] != '\n'; i++)
;
str[i] =... |
C | /*
* Exclusive locks look great on paper, but they cause awful
* performance regressions forcing all access to be sequential.
* In this case the benefit of multithreading would be lost.
*
* There is nothing wrong with every thread in the application
* reading a data structure at the same time, as long as n... |
C | #include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "llist.h"
int llisthead_init(int size, llisthead_t **h)
{
*h = malloc(sizeof(llisthead_t));
if (NULL == *h)
return -1;
(*h)->head.data = NULL;
(*h)->head.prev = (*h)->head.next = &(*h)->head;
(*h)->size = size;
return 0;
}
static void inser... |
C | #include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
int main()
{
pid_t pid;
pid = getpid();
printf("before fork: pid = %d\n", pid);
fork();
if(pid == getpid()){
printf("This is a father print\n");
}else{
printf("This is child print, child pid = %d\n", getpid());
}
... |
C | /*
** Helper's for serializing and deserializing network packets
*/
/*
** pack() -- store data dictated by the format string in the buffer
**
** bits |signed unsigned float string
** -----+----------------------------------
** 8 | c C
** 16 | h H f
** 32 | l ... |
C | #include<stdio.h>
int main()
{
int wi,wo,ho,it,ot;
float ts,tm,tl;
float re,be;
scanf("%d%d%d%d%d",&wi,&wo,&ho,&it,&ot);
ts=wi*0.08+wo*0.139+ho*0.135+it*1.128+ot*1.483;
tm=wi*0.07+wo*0.13+ho*0.121+it*1.128+ot*1.483;
tl=wi*0.06+wo*0.108+ho*0.101+it*1.128+ot*1.483;
if(ts<183) ts=183;
if(tm<383 ) tm=383... |
C | #include <stdio.h>
int next(int*, int, int);
int stage_one(int*, int);
int stage_two(int*, int, int);
int main() {
int array[10];
array[0] =7;
array[1] =8;
array[2] =9;
array[3] =3;
array[4] =2;
array[5] =6;
array[6] =6;
array[7] =1;
array[8] =4;
array[9] =4;
int meet ... |
C | /**
* block1.c
* - First Test of FruitBlock's Fruit Tiles
*/
#include <gb/gb.h>
#include "fruit.h"
void detect_ground(int *x_coord, int *y_coord, int fruit_num);
int main(void)
{
int x, y, st, key, z, i, j;
x = 32;
y = -8;
st = 0;
z = 1;
i = 0;
j = 0;
set_sprite_data(1, 9, fruit)... |
C | #include <stdio.h>
#include <string.h>
int main()
{
FILE *f = fopen("./shells", "r");
if (f)
{
while (!feof(f))
{
char s[200];
fgets(s, 200, f);
if (feof(f))
break;
s[strlen(s)-1] = 0;
printf("%s\n", s);
}
fclose(f);
}
}
|
C | #include <stdlib.h>
#include "stdio.h"
#define N 20
struct pile {
char a[N];
int sommet;
} ;
typedef struct pile pile;
pile *init_pile(void)
{
pile *p;
p = malloc(sizeof(struct pile));
p->sommet = -1;
return p;
}
int pile_est_full(pile *p)
{
return (p->sommet == N - 1);
}
int pile_est_vide(pile *p)
{
retur... |
C | #include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <process.h>
/*
* execenv <var> <value-file> <command> {<arguments>}
*/
int main(int argc, char **argv)
{
char *name;
char *value;
FILE *fh;
int size;
int i;
if(argc < 4) {
fprintf(stderr,"Burble!\n");
exit(10);
}
name = argv[1];
fh =... |
C | #define _CRT_SECURE_NO_WARNINGS
# include<stdio.h>
# include<stdlib.h>
int lifang(int a)
{
int b;
b = a*a*a;
//return b;
}
int main()
{
int lifang(int a);
int i = 100;
int a;
int b;
int c;
int d;
printf("ˮ\n");
for (i = 100; i < 1000; i++)
{
a = i / 100;
b = (i-a * 100)/10;
c = (... |
C | /*
============================================================================
Name : ListaCircular.c
Author : IHMHR
Version :
Copyright : Your copyright notice
Description : Hello World in C, Ansi-style
============================================================================
*/
#include... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ps_size.c :+: :+: :+: ... |
C | /***************************************************************************
* A toolbox for software optimization of QC-MDPC code based cryptosystems
* Copyright (c) 2017 Nir Drucker, Shay Gueron
* (drucker.nir@gmail.com, shay.gueron@gmail.com)
* The license is detailed in the file LICENSE.md, and applies to this file... |
C | #include "trigger.h"
#include "globals.h"
#include "triggerLockoutTimer.h"
#include "hitLedTimer.h"
#include "transmitter.h"
#include "supportFiles/buttons.h"
#include "supportFiles/mio.h"
#include <stdio.h>
#include "supportFiles/leds.h"
#include "supportFiles/switches.h"
#include "supportFiles/interrupts.h"
#defin... |
C | #include "circularLinkedList.h"
void printfNodeList(Node* list);
int main()
{
Node* list = NULL;
Node* currentNode = NULL;
Node* newNode = NULL;
/* 5 ߰*/
for (int i = 0; i < 5; i++)
{
newNode = createNode(i); //i ο 带
appendNode(&list, newNode); // 带 list ߰
}
/*Ʈ */
printfNodeList(list);
//Ʈ ° 忡 ο 带... |
C | // Functions to read a network stored in a GML file into a NETWORK struct
//
// Mark Newman 11 AUG 06
//
// To use this software, #include "readgml.h" at the head of your program
// and then call the following.
//
// Function calls:
// int read_network(NETWORK *network, FILE *stream)
// -- Reads a network from t... |
C | #include <stdio.h>
int main()
{
int i, counter = 0;
float R[5], arith_mean = 0;
for(i=0; i<5; i++)
{
printf("R[%d] = ", i);
scanf("%f", &R[i]);
}
for(i=0;i<5;i++)
{
if(R[i]>0)
{
co... |
C | #include <stdio.h>
#include <stdlib.h>
#define BLACK 0
#define RED 1
typedef struct N{
int chave;
int color; // 0=Black & 1=RED
struct N * left;
struct N * right;
struct N * parent;
} Node;
void add(Node ** arvore,Node *novo);
Node * createNode();
void imprimir(Node **arvore,int b);
Node *grande... |
C | #include"OW.h"
void ad_menu()//Ա˵
{
int mark=1;
for( ; mark==1; )
{
switch(s_ad_menu())
{
case 1:ad_brand();break;
case 2:ad_order();break;
case 3:ad_user();break;
case 9:mark=0;break;
case 0:quit();break;
default :printf("\n\t\t\t\tr(sntq IJڣ,س....");getchar();getchar();
}
}
}
int... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{ int i,j;
for (i=1;i<=7;i++)
{
printf("Looping yang ke %d\n",i);
for (j=1;j<=10;j++)
{
printf("-angka %d-\n",j);
}
}
return 0;
}
|
C | #include <SDL/SDL.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <stdlib.h>
#include <stdio.h>
/* Dimensions de la fenêtre */
static unsigned int WINDOW_WIDTH = 800;
static unsigned int WINDOW_HEIGHT = 600;
/* Nombre de bits par pixel de la fenêtre */
static const unsigned int BIT_PER_PIXEL = 32;
/* Nombre minim... |
C |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
int main_child(int __attribute__((unused)) ac, char **av)
{
char hdr[80];
const char * bin = strrchr(av[0], '/');
snprintf(hdr, sizeof hdr, "%s[%d]", (bin != NULL) ? (bin + 1) : av[0], getpid());
printf(... |
C | #include<math.h>
#include<stdio.h>
int main()
{
int x,y,r,p;
printf("Enter cartesian values for x and y\n");
scanf ("%d%d",&x,&y);
r= sqrt(x*x+y*y);
p=tan(y/x);
printf ("the polar coordinates of x and y are\n (%d,%d)",r,p);
return 0;
}
|
C | #include<stdio.h>
#include<stdlib.h>
char* copy(char* str);
int compare(char* str, char* fstr);
char* attend(char* str, char* fstr);
int main()
{
char* str = (char*)malloc(sizeof(char));
char* cstr = (char*)malloc(sizeof(char));
printf("Please type two string.");
scanf("%s", str);
sca... |
C | // creating a function to print the square of the given number.
#include<stdio.h>
int sqr(int a);
int main()
{
printf("Enter the nuber: ");
int a;
scanf("%i",&a);
int result=sqr(a);
printf("%i",result);
}
int sqr(int a)
{
int c = a*a;
return c;
} |
C | #include<stdio.h>
void main(){
int i=97;
int counter=0;
for(;i<=122;){
printf("%c=%d\n",i,counter);
counter++;
}
}
|
C | #include<stdio.h>
#include<math.h>
int digit();
int sumofdigit();
int factor();
int sumoffactor();
main()
{
int n,sum1,sum2;
printf("Enter number:");
scanf("%d",&n);
sumofdigit(n);
// sum1=sumofdigit();
//sum2=sumoffactor();
// if(sum1==sum2)
// {
// printf("\n%d is Smith number.",&n);
// }
// e... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
/*2) Uma string uma palavra se no contiver caracteres em branco. Dado um texto como entrada no
teclado:
a. Determinar a maior palavra e imprimi-la.
b. Class... |
C |
#include <stdlib.h>
#include <stdio.h>
#include "netsys.h"
#include "netprint.h"
#include "netsocket.h"
#define NETSOCKET_THREAD_PRIORITY (30)
static void _NetSocketThread(NetSocketT *pSocket)
{
// NetPrintf( "NetSocket: thread started (%d)\n", pSocket->socket );
if (pSocket->pWriteFunc)
... |
C | /*
** EPITECH PROJECT, 2021
** MY STR TO WORLD ARRAY
** File description:
** NO DESCRIPTION FOUND
*/
#include "../../include/my.h"
#include <stdlib.h>
int is_char(char c, int status)
{
if (status == 1) {
if ((c >= 65 && c <= 90) || (c >= 97 && c <= 122))
return (1);
} else if (status == 2) {
... |
C | #include "test_definitions.h"
BeforeAll(sample_group_setup)
{
(void) state; /* unused */
print_message("Sample group setup performed\n");
return 0;
}
AfterAll(sample_group_teardown)
{
(void) state; /* unused */
print_message("Sample group teardown performed\n");
return 0;
}
static int sample... |
C | /* Creare una libreria per gestire un oggetto di tipo grafo
* il grafo è composto da nodi e archi
* ogni arco è connesso ad al più due nodi, ogni arco ha un costo (double)
* ogni nodo è connesso a un numero variabile di archi
* se un arco è connesso ad un nodo anche il nodo è connesso a quell'arco
* Scrivere le se... |
C | #ifndef RL_H
#define RL_H
#include <math.h>
#include "bits.h"
/*
* Implementation of run-length encoding.
* 1. Get the first character c of the input string
* 2. Count the consecutive occurences n of the character c
* 3. Write c (CHAR_LENGTH bits) and n (COUNT_LENGTH bits) into the buffer
* 4. Move the pointer t... |
C | #include "fractol.h"
/*
** Magic start here. Let's see what fractol they want to see....
*/
static void init_init(t_data *all)
{
all->real_change = 0;
all->imagine_change = 0;
}
int main(int argc, char **argv)
{
t_data *all = malloc(sizeof(t_data));
all->image_height = 1000;
all->image_width = 1000;
... |
C | #include <stdio.h>
long ids[200002];
int main()
{
long n;
scanf("%ld", &n);
for (long i = 0; i < n; i++)
{
long v;
scanf("%ld", &v);
ids[v-1] = i;
}
long ans = 1;
for (long i = 1; i < n; i++)
{
if (ids[i-1] > ids[i]) ans++;
}
printf("%ld\n", a... |
C | #define MAX 100
typedef char String[MAX];
void NhapChuoi(String str);
void XuatChuoi(String str);
int TinhChieuDai(String str);
void ChenX_DauChuoi(String str, char x);
void ChenX_CuoiChuoi(String str, char x);
void ChenX_VT_BatKy(String str, char x, int vt);
void Xoa_DauChuoi(String str);
void Xoa_CuoiChuoi(String s... |
C | /* Exercise 2-4. Write an alternate version of squeeze(s1, s2) that deletes
* each character in s1 that matches any character in the string s2.
*/
#include <stdio.h>
#include <string.h>
void squeeze(char s1[], char s2[]) {
int i, j, k;
for (i = j = 0; s1[i] != '\0'; i++) {
for (k = 0; s2[k] != '\0';... |
C | /*
* @copyright (c) 2008, Hedspi, Hanoi University of Technology
* @author Huu-Duc Nguyen
* @version 1.0
*/
#include <stdio.h>
#include <stdlib.h>
#include <curses.h>
#include "vm.h"
CodeBlock *codeBlock;
WORD* stack;
WORD* global;
int t;
int b;
int pc;
int ps;
int stackSize;
int codeSize;
int debugMode;
void ... |
C | #include <sys/types.h>
#include <dirent.h>
#include <unistd.h>
#include <stdio.h>
int my_readir(const char * path)
{
DIR *dir;
struct dirent *ptr;
if((dir=opendir(path))==NULL)
{
perror("opendir");
return -1;
}
while((ptr = readdir(dir))!=NULL)
{
printf("file name:%s\n",ptr->d_name);
}
closedir(dir);
... |
C | #define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward d... |
C | /*海伦公式S=根号下p(p-a)(p-b)(p-c) 公式中a,b,c分别为三角形三边长,p为半周长,S为三角形的面积*/
#include<stdio.h>
#include<math.h>
int main()
{
float a,b,c,p,s;
printf("请输入三角形三边的边长(两边之和大于第三边或两边之和小于第三边):");
scanf("%f%f%f",&a,&b,&c);
p=(a+b+c)/2;
s=sqrt(p*(p-a)*(p-b)*(p-c));
printf("三角形面积为%.2f\n",s);
return 0;
} |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_list_reverse_fun.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <sys/types.h>
#include <regex.h>
#include <memory.h>
#include <stdlib.h>
/*
金额格式的检查 *****.** 如100.00 1000000.10 10000.01
*/
int main() {
// char * bematch = "hhhericchd@gmail.com";
// char * pattern = "h{3,10}(.*)@.{5}.(.*)";
char * bematch = "1000.0";
char * patt... |
C | #include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<fcntl.h>
#include<sys/shm.h>
#include<sys/stat.h>
#include<sys/wait.h>
int main(){
key_t k=ftok("password",1);
key_t kb=ftok("password",2);
key_t kc=ftok("password",3);
int s3=shmget(kc,4*sizeof(int),IPC_CREAT|0666);
int s1=shmget(k,... |
C | #include <stdio.h>
#include "structs.h"
#include <stdlib.h>
struct process proc[10];
struct gantt g[10];
int n;
int sum=0;
void input()
{
printf("\nEnter no. of processes");
scanf("%d",&n);
for(int i=0;i<n;++i)
{
printf("\nEnter process id of process%d\t",i);
scanf("%d",&proc[i... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "constants.h"
#define paraHOSTNAME 1
#define paraPORT 2
#define paraGAMEKINDNAME 3
#define paraGAMEID 4
#define paraPLAYERNUMBER 6
#define paraVERSION 7
#define paraCOUNT 8
char isGameidAlreadyDefined[BUFFER_SIZE] = " ";
char isPlayernumberAlreadyDe... |
C | #include <kipr/botball.h>
#include <math.h>
//#0 left +
//#1 right -
//analog(0)>=3500 black
//low : low servo position f
//high : high servo position
void forward(int velocity,int distance)
{
clear_motor_position_counter(0);
clear_motor_position_counter(1);
mtp(0,velocity,distance);
mtp(1,velocity,-di... |
C | #include<stdio.h>
#include<string.h>
#include<stdbool.h>
void plainText();
void orignal(char*);
void encryption(char*);
void decryption(char*);
bool check(char*);
bool goes[10];
int length;
int key=0;
void main()
{
plainText();
}
void plainText()
{
char message[10];
printf("Enter 9 digit message(must be sma... |
C | #include <stdlib.h>
#include <stdio.h>
#include <pthread.h>
// For getpid(), ..
#include <sys/types.h>
#include <unistd.h>
// For time(), ..
#include <time.h>
// For perror(), errno, ..
#include <errno.h>
#include "thread.h"
/////////////////////////////////////////////////////////////////////////////////////
vo... |
C | #include <stdio.h>
#include <stdlib.h>
/* 1 */
void sorting(double *array[], int n);
void show_array(double *array[], int n);
int main(){
/* 2 */
double array[2];
double *index[3];
/* 2.1 */
for(int i = 0; i < 3; i++){
printf("--> ");
index[i] = (double *)malloc(sizeof(double));
... |
C | #include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "macros.h"
#include "mesh.h"
#include "objloader.h"
#define BUFSZ 1024
static void parse_vertex(const char *line, struct vec4 *v);
static int parse_face(const char *line, struct pe_vidx *v);
void
pe_objload(struct mesh *m, cons... |
C | //#pragma warning(disable:4996)
//#include<stdio.h>
//#include<conio.h>
//#include<stdlib.h>
//int main()
//{
// FILE* fpSrc;
// FILE* fpDest;
// char caSrcFileName[20];
// char caDestFileName[20];
// scanf("%s", caSrcFileName, 20);
// fopen(&fpSrc, caSrcFileName, "r");
// printf("\n");
// scanf("%s", caDestFileName, 2... |
C | #include <stdio.h>
int checkSymmetric(int a[], int n);
void main() {
int a[100], n, i;
printf(" Number of elements: ");
scanf("%d", & n);
for (i = 0; i < n; i++) {
printf("a[%d]= ", i);
scanf("%d", & a[i]);
}
printf("\n Array's content:\n");
for (i = 0; i < n; i++)
... |
C | #include "client.h"
int fd;
struct sockaddr_in addr;
pthread_t tid;
// socket init with given address
int socket_init(char *str)
{
int ret = 0;
// socket input
fd = socket(AF_INET, SOCK_STREAM, 0);
if (fd == -1)
return (-1);
// using IPv4, port : 12345, ip address : (input)
addr.sin... |
C | /*
You are given a natural number called n. Print all the prime divisors of n.
Example: input -> 12
output -> 2^2
3^1
*/
#include <stdio.h>
static void PrimeDivisors (unsigned int n)
{
size_t d = 2;
while (d * d <= n && n > 1) {
if (n % d == 0) {
size_t power = 0;
while (n % d == 0) {
po... |
C | #include<stdio.h>
#include<Windows.h>
#define Maxsize 100
/**/
int* Input(int num);//Ϊϣ0λݴݣݴ1λʼ
int* Shell_sort(int a[], int num);//ϣ
void Print(int a[], int num);//ӡ
int main() {
printf("Ҫٸ:");
int num;//ٸ
scanf_s("%d", &num);
num = num + 1;//0λݴ,Ӧöһλ
int* a;
a = Input(num);
/*ʼָתΪ飨ΪcԺܽ鴫*/
int i, b[Maxsize... |
C | #include <stdio.h>
#include <global.h>
#include <input.h>
#include <print.h>
#include <memory.h>
#include <cmd.h>
#include <init.c>
typedef struct state
{
int parent_ino;
int my_ino;
int rec_len;
int name_len;
char name[256];
u16 type;
u16 links_count;
int size;
u16 uid;
... |
C | #include <errno.h>
#include <unistd.h>
#include <sys/types.h>
/* Set the foreground process group ID of FD set PGRP_ID. */
int
tcsetpgrp (fd, pgrp_id)
int fd;
pid_t pgrp_id;
{
if (fd < 0)
{
_set_errno (EBADF);
return -1;
}
_set_errno (ENOSYS);
return 0;
}
|
C | #define _CRT_SECURE_NO_WARNINGS //
#include <stdio.h>
int main02()
{
int arr[10] = { 0,1,2,3,4,5,6,7,8,9 };
int size = sizeof(arr) / sizeof(arr[0]);
for (int i = 0; i < size ; i++)
{
arr[i] = arr[i] + arr[size - 1];
arr[size - 1] = arr[i] - arr[size - 1];
arr[i] = arr[i] - arr[size - 1];
size--;
}
f... |
C | #include "msrp_session.h"
/*
Contexts management
*/
/*
Recursive function to get the full context path, considering its relay hops
*/
char *msrp_context_build_path(msrp_context *context)
{
if(!context)
return NULL;
if(!context->relay)
return NULL;
/* Get previous paths recursively */
char *path = msrp_conte... |
C | #include<stdio.h>
#include<stdlib.h>
typedef struct node{
int data;
struct node *next;
}nodetype;
nodetype* insert(nodetype*);
nodetype* dequeue(nodetype*);
void display(nodetype*);
int main(){
nodetype *front=NULL,*rear=NULL;
int ch;
do{
printf("\n1 Insert \n2 Delete \n3 Display \n4 Exit \... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* comb.c :+: :+: :+: ... |
C | #include "bubblesort.h"
///////////////////////////////////////////////////////
//////////仿照qsort写自己的冒泡排序通用函数////////////////
///////////////////////////////////////////////////////
int cmp(const void* e1,const void* e2)//比较函数
{
return *(int*)e2 - *(int*)e1;
}
int main()
{
int arr[10] = { 9,0,8,7,6,5,4,1,3,2 };
bu... |
C | #include<stdio.h>
#include<conio.h>
void main()
{
long int n,m=1,rem,ans=0;
printf("\nEnter Your Decimal No : ");
scanf("%d",&n);
while(n>0)
{
rem=n%8;
ans=(rem*m)+ans;
n=n/8;
m=m*10;
}
printf("\nConvert into Octal No is : %d",ans);
}
|
C | // Driverlib includes
#include "rom.h"
#include "rom_map.h"
#include "hw_memmap.h"
#include "hw_common_reg.h"
#include "hw_types.h"
#include "hw_ints.h"
#include "uart.h"
#include "interrupt.h"
#include "pinmux.h"
#include "utils.h"
#include "prcm.h"
// Common interface include
#include "uart_if.h"
//... |
C | #include <stdio.h>
#include <stdlib.h>
int Compare(const void *e1, const void *e2)
{
int *p1 = (int*)e1;
int *p2 = (int*)e2;
return (*p1 - *p2);
}
int main()
{
int size, sum = 0, i;
int *arr = NULL;
double average = 0.0;
printf(" ԷϽðڽϱ? :");
scanf("%d", &size);
arr = malloc(sizeof(int) * size);
printf("... |
C | #include<stdio.h>
#include<stdlib.h>
void mymemset(void *ptr,int val,int len)
{
if(ptr!=NULL && len > 0)
{
unsigned char *temp=ptr;
int i=0;
for(i=0;i<len;i++)
{
*temp++=(unsigned char)val;
}
}
}
int main()
{
char *ptr;
ptr=(char *)malloc(sizeof(char));
mymemset(ptr,'a',sizeof(ptr));
puts(ptr);
}
|
C | /******************************************************************************
* Created by Jarni Vanmal
* freertos_hello_world.c: Using Buttons
******************************************************************************/
/* FreeRTOS includes. */
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#inclu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.