language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include <stdio.h>
int square(int a);
int main()
{
int var1,result;
printf("enter first number");
scanf("%d",&var1);
result=square(var1);
printf("result=%d",result);
return 0;
}
int square(int a)
{
int c;
c=a*a;
return c;
} |
C | #include<stdio.h>
#include<math.h>
int main()
{
int num,sum,i=1;
scanf("%d",&num);
while(i!=num+1){
if(i%2==0){
sum=pow(i,2);
printf("%d^2 = %d\n",i,sum);
}
i++;
}
return 0;
}
|
C | /* branch.c - Branch instructions, and instructions which are complex to do
*
* $Revision: 2.22 $
* $Date: 1999/12/27 04:38:29 $
*/
#include "defines.h"
/* We use the following macro for the branch instructions below */
#define do_branch() \
{ offset = LOW8(ir); \
if (offset & SIGN_B) \
offset += 017740... |
C | #include <stdio.h>
int main(){
int a,b;
char operator;
printf("set operator : ");
scanf("%c",&operator);
printf("set A :");
scanf("%d",&a);
printf("set B :");
scanf("%d",&b);
switch(operator){
case '+': plus(a,b); break;
case '-': minus(a,b); break;
case '*': mult(a,b); break;
c... |
C | #include <stdio.h>
#include <locale.h>
#include <stdlib.h>
#include <conio.h>
#include <string.h>
struct endereco{
char rua [100];
char numrua [10];
char bairro [20];
char cep [20];
char cidade [20];
char estado [20];
char pais [20];
};
struct telefone{
char ddd [10];
... |
C | #include <stdlib.h>
#include <stdio.h>
#define ERROR 0;
#define OK 1;
//链表元素定义
typedef int elem;
//节点设定
typedef struct list
{
elem list_Data;
struct list *list_Next;
} myList, *pMyList;
//函数声明
pMyList Initialize(); //初始化一个单链表,返回一个头指针
_Bool Add_List(pMyList p, e... |
C | #ifndef _CJSON_COMMON_H_
#define _CJSON_COMMON_H_
#include <stdio.h>
#include <stdlib.h>
#include "cJSON.h"
inline CJSON_PUBLIC(char*) read_file(const char *filename)
{
FILE *file = NULL;
long length = 0;
char *content = NULL;
size_t read_chars = 0;
/* open in read binary mode */
fopen_s(&file, filename, "rb")... |
C | #ifndef LAYER_H
#define LAYER_H LAYER_H
typedef struct obscured Obscured;
typedef struct layer Layer;
struct obscured{
Rectangle rect; /* obscured rectangle, screen coords */
Bitmap *bmap; /* where the obscured data resides */
Layer *lobs; /* layer currently in rect on screen */
Obscured *next; /* chaining */
Obsc... |
C | //Bucket Sort
#include <conio.h>
#include <stdio.h>
void main()
{
int unsorted[50] , bucket[10][50]={{0}} , sorted[50] ;
int j , k , m , p , flag = 0, num, N;
clrscr();
printf("\n\t\t\t\tBUCKET SORT");
printf("\n\t\t\t\t***********\n\n\n");
printf("\n\nENTER THE NUMBER OF ELEMENTS:");
scanf("%d", &N);
... |
C | /*Student Name=Sunil Giri
Subject=Programming Fundamentals
Roll No.=
Program=program to print multiplication table using for loop.
Lab No.=25
BCS Sem.=1st
Date=jan 5,2017
*/
#include<stdio.h>
//#include<conio.h>
int main()
{
int i=1,j,n,mul;
printf("Enter number of terms to print multiplication table:");
scanf("... |
C | #include <stdio.h>
#include <stdlib.h>
void ffunc_a(int a);
void ffunc_aa(int *a);
void ffunc_aaa(int **a);
void ffunc_b(int b);
void ffunc_bb(int b[]);
void ffunc_bbb(int (*b)[1]);
void cfunc_a(int a){}
void cfunc_aa(int *a){}
void cfunc_aaa(int **a){}
void cfunc_b(int b){}
void cfunc_bb(int b[]){}
void cfunc_bbb(in... |
C | #include <stdbool.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "logger.h"
#include "debug.h"
#include "forth.h"
#include "code.h"
#include "parser.h"
#include "dictionary.h"
#include "compiler.h"
#define LOG "compiler"
#define IN_COMPILATION 1
static void add_literal(uint32_t);
static void... |
C | #include <stdio.h>
#include <dlfcn.h>
#include <stdint.h>
typedef int (*pfn_main)(int,char**);
typedef uint32_t Elf32_Addr;
typedef uint32_t Elf32_Word;
typedef uint32_t Elf32_Off;
typedef int32_t Elf32_Sword;
typedef uint16_t Elf32_Half;
typedef struct
{
Elf32_Word p_type;
Elf32_Off p_offset... |
C | #include <stdio.h>
int main() {//
int p,i,e,d,a,t = 1;
while(scanf("%d %d %d %d",&p,&i,&e,&d) && d!=-1) {
a = (p * 5544 + i * 14421 + e * 1288 + 21252 - d) % 21252;
printf("Case %d: the next triple peak occurs in %d days.\n",t++,a?a:21252);
}
return 0;
} |
C | #include "holberton.h"
/**
* times_table - description
*/
void times_table(void)
{
int num1, num2, r;
for (num1 = 0; num1 < 10; num1++)
{
for (num2 = 0; num2 < 10; num2++)
{
r = num1 * num2;
if (r < 10)
{
if (num2 > 0)
_putchar(' ');
_putchar('0' + r);
}
else
{
_putchar('... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <malloc.h>
#include "hometask_5.h"
int main(void)
{
printf("\t\t\t\t - Array of Circles -\n\n-Please indicate number of circles by integer value ...\n\n- Your value: ");
int number_of_Circles = check_value_func();
Circle_Array *cur... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* xattr.c :+: :+: :+: ... |
C | #include <stdio.h>
char leapYear(unsigned short year);
/*
we have to use the next function because func leapYear only works for years
between 1701 and 3000
*/
unsigned short verification(unsigned short year);
int main()
{
unsigned short year;
printf("\n**Welcome**\n");
do
{
printf("enter a year\n");
fflush(s... |
C | #include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
/*
Aperto uno stream possono essere utilizzate 3 modalita' di I/O non bufferizzato:
- Character at a time I/O, lettura/scrittura di un carattere alla volta;
- Line at a time I/O , lettura/scrittura di una linea alla volta;
- Direct I/O ... |
C | //22248242 1162 Organizador de Vagões Accepted C 0.208 09/04/2021 17:12:17
#include <stdio.h>
int S;
void bubbleSort2 (int *vetor, int N) {
int i, j, aux, troca = 1;
S = 0;
for (i = 0; (i < N-1) && troca; i++) {
troca = 0;
for (j = 0; j < N-i-1; j++) {
if (vetor[j] > vetor[j+1... |
C | /*
* Project Euler - Problem 19
* Counting Sundays
*
* You are given the following information:
*
* 1 Jan 1900 was a Monday.
* Thirty days has September,
* April, June and November.
* All the rest have thirty-one,
* Saving February alone,
* Which has twenty-eight, rain or shine.
* And on leap years, twent... |
C | /*
** EPITECH PROJECT, 2017
** minicut
** File description:
** utils_string.c
*/
#include <stdlib.h>
int my_strlen(char *str)
{
int len = 0;
while (str && str[len])
len++;
return (len);
}
int my_strcmp(char *s1, char *s2)
{
int i = 0;
if (!s1 || !s2) {
if (!s1 && !s2)
return (0);
else if (!s1)
ret... |
C | #include"sys.h"
typedef int elem;
typedef struct Node
{
elem data;
struct Node* next;
}node,*pnode;
//头插
bool add(pnode* phead,elem data)
{
pnode pnew;
pnew=malloc(sizeof(node));
if(pnew==NULL)
{
printf("fail!");
return false;
}
pnew->data=data;
pnew->next=*phead;
*phead=pnew;
return true;
}
//尾插
bool a... |
C | /*
Descrio
A inveno do carro tornou muito mais rpido e mais barato realizar viagens de longa distncia. Realizar uma viagem rodoviria tem dois
tipos de custos: cada quilmetro percorrido na rodovia tem um custo associado (no s devido ao consumo de combustvel mas tambm devido ao
desgaste das peas do carro, pneus, etc.), ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
int checker(int a, int b, int wynik) /*funkcja sprawdza czy wynik jest dobry. zwraca 1 gdy dobry, 0 gdy zły*/
{
if(wynik==a*b)
{
return 1;
}
else
{
return 0;
}
}
int rnd(int min, int max) /* funkcja losuje liczbę z podanego zakre... |
C | #include <stdio.h>
#include <stdlib.h>
typedef struct polyNode{
int coef;
int exp;
struct polyNode *next;
}polyNode, *polyList;
void DestroyList(polyList L);
void printList(polyList L);
polyList creatList(int n);
polyList add(polyList a, polyList b);
polyList mul(polyList a, polyList b);
int ... |
C | #include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <time.h>
#include <sys/times.h>
struct full_time{
__clock_t user_time;
__clock_t system_time;
} type... |
C | // Constantes de erro
#define ERRO_LDE_VAZIA -1
#define ERRO_POS_INVALIDA -2
//Elemento da Lista Duplamente Encadeada (LDE)
typedef struct eleDuplo{
void *info;
struct eleDuplo *ant, *suc;
}EleDuplo;
// Cabeçalho da Lista Duplamente Encadeada (LDE)
typedef struct cabecalhoLDE{
EleDuplo *cabeca;
int ta... |
C | #include "get_web_object.h"
struct Cache {
char *document_path;
char *document_name;
char *host_name;
struct Cache *next;
};
int main(int argc, char *argv[]) {
char **filename_pointer, *filename, *filepath, **host_pointer, *host, *message, *request, *response, *content;
unsigned long ip, local_host;
int serv... |
C | // *****************************************
// Filename: ini.h
// Author: Klas Henriksson
//
// Purpose:
// Provides simple access to .INI files
//
// Revision History:
// -
//
// Copyright (c), Klas Henriksson.
//
// *****************************************
//currently uses stack, no heap at all.
#ifndef... |
C | /*
* File handling functions for HTMLCSS library.
*
* https://github.com/michaelrsweet/htmlcss
*
* Copyright © 2018-2022 by Michael R Sweet.
*
* Licensed under Apache License v2.0. See the file "LICENSE" for more
* information.
*/
/*
* Include necessary headers...
*/
#include "file-private.h"
/*
* ... |
C | //
// Created by Once on 2019/7/8.
//
#ifndef DATALGORITHM_STREE_H
#define DATALGORITHM_STREE_H
// 数据对象
typedef struct movie{
int id; // 关键字,唯一键,按id排序
char name[128];
char about[512];
} Movie;
// 树结点
typedef struct mnode{
Movie movie;
struct mnode *left; // 左儿子
struct mnode *right; // 右儿子
} M... |
C | #include <stdio.h>
#include <assert.h>
double pow(double base, double exp) {
int i, result;
result = 1;
for (i = 1; i <= exp; ++i) {
result = result * base;
}
return result;
}
int main() {
assert(pow(2, 3) == 8);
assert(pow(1, 6) == 1);
assert(pow(3, 3) == 27);
assert(pow(2, 8) == 256);
assert... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* parser.c :+: :+: :+: ... |
C | #include "lists.h"
/**
* add_nodeint_end - node at the end
* @head: head pointer
* @n: number that will be added
* Return: address at the new node created
*/
listint_t *add_nodeint_end(listint_t **head, const int n)
{
listint_t *tail = *head, *node;
node = malloc(sizeof(listint_t));
if (node == NULL)
return ... |
C | #include <stdlib.h>
#include "stm32f10x.h"
#include "utils.h"
#include "update.h"
#include "ff.h"
#include "platform.h"
#include "onchip_flash.h"
#define UP_PROGRAME_FILENAME "update.bin"
/* ȫļϵͳ */
static FATFS g_fs;
/* ļ */
static FIL g_updateFile;
/* дflashĻ */
static u8 g_readBuf[FLASH_PAGE_SI... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include "sm_message.h"
#include "config.h"
/*
*
*/
msg_t *sm_msg_create(char nid, char type, char buffer[]) {
msg_t *message = malloc(sizeof(msg_t));
memset(message, 0, sizeof(msg_t));
message->... |
C | /*
* Fonte: http://www.cs.cf.ac.uk/Dave/C/node27.html
*/
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
/* Tamanho do segmento compartilhado. */
#define SHMSZ 27
int main() {
int shmid;
key_t k... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
typedef struct unit {
char *name;
char *info;
int numOfPickups;
int numOfFrets;
int numOfString;
float menzureLength;
float neckRadius;
int *stringsWidth;
} guitar;
enum values {
nameLength = 35,
inpu... |
C | #include <stdio.h>
int sum(int n) {
if(n == 1) {
return 1;
}
return n * n + sum(n - 1);
}
int main(int argslen, char * args []) {
printf("SUM = %d \n", sum(5));
return 0;
}
|
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_atoi_base.c :+: :+: :+: ... |
C | // DevEBox STM32F407VGT6 development board
// Demo RTC Calendar (date/time) configuration and read
// Also demonstrate that RTC is not affected by going to standby
// mode (Standby mode does not affect LSE, RTC continues to get clock
// and RTC is in backup domain)
#include "main.h"
#include "stdio.h"
#include... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* init.c :+: :+: :+: ... |
C | #include <stdio.h>
#include "ConfigAccess.h"
#include "MetaDataAccess.h"
#include "ProcessCtrl.h"
#include "simtimer.h"
#include "log.h"
int main( int argc, char ** argv )
{
char *timeStr = (char *) malloc( MAX_STR_LEN );
int configAccessResult, mdAccessResult;
char configFileName[ MAX_STR_LEN ];
char m... |
C | /*
** EPITECH PROJECT, 2018
** PSU_myirc_2017
** File description:
** nick_registration
*/
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "server.h"
static bool check_nickname_in_use(server_t server, char *nick, int index)
{
client_list_t tmp = server->client_list;
if (!st... |
C |
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* File: PowerAllocation.c
* Author: Nishtha
*
* Created on April 15, 2019, 5:24 PM
*/
#include<stdio.h>
//#include<conio... |
C | /*-
* Copyright (c) 2011 Abhinav Upadhyay <er.abhinav.upadhyay@gmail.com>
* All rights reserved.
*
* This code was developed as part of Google's Summer of Code 2011 program.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions... |
C | #include <stdbool.h>
#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#define LARGO 25
#define MAX_CADENA LARGO-2
void lp(void){
system( "clear" );
}
void barra0(char caracter){
for (int n =0; n < LARGO; n++) printf("%c ", caracter);
puts("");
for (int n =0; n < LARGO;... |
C | #include<stdio.h>
#define max 25
int n=9;
int z;
void printsol(void);
void place(int row,int col);
int board[max][max]={0};
int copy[max][max]={0};
int main()
{
int row;
int i=0,j,k;
for(j=0;j<n;j++){
for(k=0;k<n;k++){
scanf("%d",board[j][k]);
if(board[i][j]!=0){
copy[i][j]=1;
}
}
}
fl=0;
place(... |
C | //413. Pinhole Imaging
#include <stdio.h>
#include <iostream>
using namespace std;
int main(int argc, char const *argv[])
{
long t,a,b,h;
cin>>t;
while(t--){
cin>>a>>b>>h;
printf("%.2lf\n", (double) b*h/a);
}
return 0;
} |
C | #ifndef __LLVM_STATEPOINT_UTILS_API__
#define __LLVM_STATEPOINT_UTILS_API__
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
/**** Types ****/
typedef struct {
// kind < 0 means this is a base pointer
// kind >= 0 means this is a pointer derived from base pointer in slot number "kind"
int32_t ... |
C | #include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <netdb.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/ip.h>
#include <netinet/in.h>
#include <netpacket/packet.h>
#include <net/ethernet.h>
#include <net/if.h>
#include <arpa/inet.h>
#incl... |
C | /*
* Compile the provided program need6.c into the binary need6. Complete the
* following program so that it creates a subprocess that eventually executes
* the binary need6 in the current directory.
*
* The need6 program simply reads from file descriptor 6, counts the number of
* bytes that can be read from fi... |
C | #include <stdio.h>
#include <stdlib.h>
void nhapXau(char a[])
{
fflush(stdin);
gets(a);
}
void xuatXau(char a[])
{
puts(a);
}
int main()
{
char s1[20];
char s2[20];
printf("\nNhap xau s1: ");
nhapXau(s1);
printf("\nNhap xau s2: ");
nhapXau(s2);
printf("s1: ");
puts(... |
C | #include <stdio.h>
// returns true if there is triplet with sum equal
// to 'sum' present in A[]. Also, prints the triplet
int find3Numbers(int A[], int arr_size, int sum)
{
int l, r,i,j,k;
// Fix the first element as A[i]
for (i = 0; i < arr_size - 2; i++) {
// Fix the s... |
C | #include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <math.h>
#define ceild(n,d) ceil(((double)(n))/((double)(d)))
#define floord(n,d) floor(((double)(n))/((double)(d)))
#define max(x,y) ((x) > (y)? (x) : (y))
#define min(x,y) ((x) < (y)? (x) : (y))
#include "decl.h"
double rtclock()
{
stru... |
C | #include <stdio.h>
/**
* print_buffer - function that prints a buffer
* @b: buffer
* @size: buffer size
* Return: void
*/
void print_buffer(char *b, int size)
{
int x, j;
if (size <= 0)
printf("\n");
else
{
for (x = 0; x < size; x += 10)
{
printf("%08x: ", x);
j = 0;
while (j < 10)
{
i... |
C | #include <stdint.h>
/**
* Reverse bytes in words
* @param in word in form abcd
* @returns word in form dcba
*/
uint32_t rev_bytes(uint32_t in);
|
C | #include <stdio.h>
#include <time.h>
#include "Time.h"
void printTime(void)
{
time_t timer = time(NULL);
struct tm *time;
time = localtime(&timer);
char timeString[9];
strftime(timeString, 9, "%T", time);
printf("Time: %s\n", timeString);
}
|
C | #include "hash_tables.h"
/**
* shash_table_create - creates a hash table
*
* @size: size of hash table
*
* Return: Pointer to newly created hash table, NULL on fail.
*/
shash_table_t *shash_table_create(unsigned long int size)
{
shash_table_t *table;
unsigned long int i;
table = malloc(sizeof(shash_table_t)... |
C |
#ifdef __cplusplus
extern "C" {
#endif
#define _QSORT_TYPE int
#define _QSORT_FNAME bfls_qsort_int
#define _QSORT_CMP(ele1, ele2) ((ele1) >= (ele2))
#include "_qsort.h"
#define _QSORT_TYPE int
#define _QSORT_FNAME bfls_qsort_int_de
#define _QSORT_CMP(ele1, ele2) ((ele1) <= (ele2))
#include "_qsort.h"
... |
C | /******************************************************************************
* Student Name : Federick Kwok
* RMIT Student ID : s3666874
* COURSE CODE : CPT220
*
* Startup code provided by Paul Miller for use in "Programming in C",
* study period 2, 2018.
***********************************************... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* delete.c :+: :+: :+: ... |
C | /*
** EPITECH PROJECT, 2017
** my_rpg_2017
** File description:
** get.c
*/
#include "rpg.h"
int items_foreach_horizontaly(int y, game_t *game,
window_t *window, int (*fptr)())
{
int my_errno = 0;
for (int x = 0; x != INVENTORY_SIZE_X; x++) {
if (!window) {
my_errno = fptr(&ITEMS[y][x], &SLOT_POS(x, y), g... |
C | #include <unistd.h>
#include "prototype.h"
#include <stdio.h>
void partie_joueur_aleatoire(int taille, char *board) {
char player_color;
char c; //Pour la ligne qui vide le buffer du scanf
printf("\n\nWelcome to the 7 wonders of the world of the 7 colors\n"
"**************************************************... |
C |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "GameReader.h"
#include "space.h"
STATUS game_reader_load_spaces(Game* game, char* filename) {
int i,j;
FILE* file = NULL;
char line[WORD_SIZE] = "";
char name[WORD_SIZE] = "";
char* toks = NULL;
Id id = NO_ID, north = NO_ID, east = ... |
C | #include <stdio.h>
#include <stdlib.h>
#define gc getchar_unlocked
inline void scanint(int *x)
{
register int c = gc();
*x = 0;
int neg = 0;
for(;((c < 48 || c > 57) && c != '-'); c = gc());
if(c == '-') { neg = 1; c = gc(); }
for(; c > 47 && c < 58; c = gc()) { *x = ((*x) << 1) ... |
C | #include "./include/header.h"
/**
* Ejercicio 1 Funciones
*/
int main(int argc, char *argv[]) {
char categoria[9], // moto, auto, camion, camioneta
horario, // a,b (A: pico B: no pico)
condFin;
float importeEnt, // Importe otorgado por el conductor
importeCob, // Importe calculado de... |
C | //从键盘上输入字符,(1)分别统计一下其中字母,数字,其他字符的个数, (2)将统计的字母,数字,其他字符的个数以柱状图的形式打印。
// 5
//*****
//***** 3
//***** ***** 2
//***** ***** *****
//***** ***** *****
// alp num oth
//
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
void process(int para, int i) {
if (para<i) printf(" ");
else if (... |
C | #include<stdio.h>
int main(){
int num;
scanf("%d",&num);
if(num>0){
printf("its positive");
}
else{
printf("Its negetive");
}
return 0;
}
|
C | #include <stdio.h>
int main()
{
int num, nth, res;
printf("Enter number: ");
scanf("%d", &num);
printf("Enter nth bit to clear: ");
scanf("%d", &nth);
res = num & (~(1) << (nth - 1));
printf("%d", res);
return(0);
}
|
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 |
#include <stdio.h>
#include <stdlib.h>
int merge_sort(int *Array, int length);
int merge(int *Array, int length, int *left_array, int *right_array);
int main()
{
printf ("\nMerge sort algorithm\n");
int input_nos[5];
int i, temp, j;
printf ("\nEnter 5 numbers:");
for (i = 0; i < 5; i++)... |
C | #include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <limits.h>
#include <dirent.h>
#include <sys/wait.h>
#define clear() printf("\033[H\033[J")
#define MAX_LINE 80 /* 80 chars per line, per command, should be enough. */
//1501138... |
C | //check type:c/cpp
#define JUDGE if //not compliant
#define int64 long //not compliant
int main_bad(void)
{
int64 i = 0;
JUDGE(0 == i)
{
i = 1;
}
return 0;
}
#define JUDGE_ZERO(i) if (0 == (i)) // ok-1
typedef long int64; // ok-2
int main_good(void)
{
... |
C | #define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int factorial(int num)//׳˵ĺ
{
int i = 1;
if (num == 0)
return 1;
else
{
int sum = 1;
for (int i = 1; i <= num; i++)
sum *= i;
return sum;
}
}
void function(int rowNum)//ӡ
{
int num = 0;
int i = 1;
int j = 1;
for (int n = 1; n <= rowNum; ++n)//ӡÿ... |
C | int singleNumber(int A[], int n) {
int i, tmp;
for (i = 0; i < n; ++i) {
tmp = tmp ^ A[i];
}
return tmp;
}
|
C | #include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<fcntl.h>
#include "student.h"
int main(int argc, char *argv[])
{
int fd,id;
struct student record;
struct flock lock;
if(argc < 2) {
fprintf(stderr,"사용법 : %s 파일 \n", argv[0]);
exit(1);
}
if((fd = open(argv[1],O_RDONLY)) == -1){
perror(argv[1... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* filler.h :+: :+: :+: ... |
C | /*
* File: qlist.c
* -------------
* This file implements the queue.h abstraction using a linked
* list of cells.
*/
#include <stdio.h>
#include "genlib.h"
#include "queuelist.h"
/*
* Type: cellT
* -----------
* This type defines the cells used for the linked list that
* stores the items in the... |
C | #include <avr/io.h>
#include <util/delay.h>
int main (void)
{
/*
* set PORTA pins 0-4 as input
* set PORTA pins 5-7 as output
* PORTB pins 0-7 as output
* PORTC pins 0-7 as output
* PORTD pins 0-5 as output
* remaining PORTD pins 6, 7 -- use later
*/
/*
* fo... |
C | #if !defined(HASHMAP_H)
#define HASHMAP_H
typedef struct hashmap_item_t hashmap_item_t;
typedef hashmap_item_t *hashmap_item_p;
struct hashmap_item_t
{
void *key;
void *content;
hashmap_item_p next;
hashmap_item_p prev;
};
typedef unsigned (*hash_func_t)(const void *);
typedef char (*compare_func_t)(c... |
C | #ifndef _LEVEL_IO_H_
#define _LEVEL_IO_H_
/* Defines interface for reading SYY3 levels from files. */
enum Colors { cRED, cGREEN, cBLUE, cYELLOW, cANY };
struct Level {
struct Leon *leon;
struct World *world;
struct Fruits *fruits;
struct Babies *babies;
};
struct Leon {
int x, y, z, clr, len, b... |
C | #include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
const char *shmname = "/somename";
void die(const char *msg)
{
perror(msg);
exit(1);
}
int main()
{
int *shared;
int fd = shm_open(shmname, O_RDWR|O_CREAT, 0600);
if (fd < 0)... |
C | #include <stdio.h>
#include <stdlib.h>
typedef struct Node
{
int value;
struct Node* next;
}Node;
Node* flipList(Node* head) /* Ex 1 */
{
Node* prevNode;
Node* currentNode;
if(head != NULL)
{
prevNode = head;
currentNode = head->next;
head = head->next;
prevNode->next = NULL;
while(head != NULL)... |
C | #include <stdio.h>
main(void)
{
char c,l;
char lower(char s);
while ((c=getchar()) != '\x1a')
{
l = lower(c);
putchar(l);
}
}
char lower(char s)
{
if (s >= 'A' && s <= 'Z')
s = s+('a'-'A');
return s;
}
|
C | /* the first listing */
// gcc -Wall getting-started.c -o getting-started
#include "stdio.h"
#include "stdlib.h"
int main(void){
double A[5] = {9.0, 2.9, 3.E+25, .002, 1.1};
for (size_t i=0; i<5; ++i) {
printf("%zu: %g squared=%g\n", i, A[i], A[i]*A[i]);
}
return EXIT_SUCCESS;
}
|
C | /*
============================================================================
Name : estructurasAnidadas.c
Author :
Version :
Copyright : Your copyright notice
Description : Hello World in C, Ansi-style
============================================================================
*/
/*estruc... |
C | #ifndef UNIVERSAL_H
#define UNIVERSAL_H
#include "ady_types.h"
#include "ady_math.h"
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// ============================================================================
// Macros
#define ArrayCount(Array) sizeof(Array) / sizeof((Array)[0])
#... |
C | #ifndef SISTEMA_ENTRADA_H
#define SISTEMA_ENTRADA_H
#include <stdio.h>
#include <stdlib.h>
#define N 200 //Tamaño de cada uno de los dos bloques del sistema de entrada (sin incluir los EOF)
/*Devuelve el valor al que apunta el puntero delantero (en caso de que sea necesario,
* carga un nuevo bloque) y actualiza el va... |
C | /*
+-------------------+
| | Christian Schlittchen <corwin@amber.kn-bremen.de>
| Eressea PBEM host | Enno Rehling <enno@eressea.de>
| (c) 1998 - 2004 | Katja Zedel <katze@felidae.kn-bremen.de>
| |
+-------------------+
This program may not be used, modified or distribute... |
C | #include<stdio.h>
void main() {
for(int i = 33; i < 127; i++) printf("Character %d: %c\n", i, i);
} |
C | #include "../common.h"
#include <poll.h>
#include <signal.h>
#include <termios.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include "../buf.h"
#include "../iface.h"
#include "../scr.h"
/**
* Implementation structure.
* @input, output: Input and output file descriptors.
* @seqi: The sequence index.
* @seq:... |
C | /* shellsort: v[0]...v[n-1] Ƀ\[g */
void shellsort(int v[], int n)
{
int gap, i, j, temp;
for (gap = n/2; gap > 0; gap /= 2)
for (i = gap; i < n; i++)
for (j=i-gap; j>=0 && v[j]>v[j+gap]; j-=gap) {
temp = v[j];
v[j] = v[j+gap];
v[j+gap] = temp;
}
}
#include <stdio.h>
int main(v... |
C | // 其中R位于报告第一位,共分5级,用1—5数字表示.
// 1---Unreadable
// 2---Barely readable, occasional words distinguishable
// 3---Readable with considerable difficulty
// 4---Readable with practically no difficulty
// 5---Perfectly readable
// 报告第二位是S,共分九个级别,用1—9中的一位数字表示
// 1---Faint signals, barely perceptible
// 2---Very weak signals
/... |
C | //
// Created by Mihai on 3/23/2020.
//
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <stdbool.h>
#define MAX_LINE 100
#define MAX_ID 5
#ifndef ASSIGNMENT_3_1_HEADER_H
#define ASSIGNMENT_3_1_HEADER_H
typedef struct _node {
char data;
struct _node *next, *prev;
} NodeT... |
C | #include <stdio.h>
int self_desc(const char *s)
{
unsigned char cnt[10] = {0};
int i;
for (i = 0; s[i] != '\0'; i++) cnt[s[i] - '0']++;
for (i = 0; s[i] != '\0'; i++) if (cnt[i] + '0' != s[i]) return 0;
return 1;
}
void gen(int n)
{
char d[11];
int one, i;
/* one = 0 may be confusing. 'one' is the number of ... |
C | // chapter 05-01
/*
-구조체
-포인터 함수
-구조체 선언
-구조체로 명함만들기
-구조체 포인터
*/
#include <stdio.h>
#include <windows.h>
void add(double num1, double num2){
double result;
result = num1 + num2;
printf("%f + %f = %f 입니다.\n", num1, num2, result);
}
int main(void){
system("chcp 65001");
// 함수의 이름은! 함수의 시작 주소를 의미하느... |
C | //
// Created by alex on 19/05/2021.
//
#include "BuscaGrafo.h"
void buscaProfundidade(Grafo *gr, int ini, int *visitado, int cont){
int i;
visitado[ini]=cont;
for (i=0; i<gr->grau[ini]; i++){
if(!visitado[gr->arestas[ini][i]]){
buscaProfundidade(gr, gr->arestas[ini][i], visitado, cont... |
C |
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char** argv) {
int n;
scanf("%d", &n);
unsigned long long result = 1;
int j;
int factorialN = 1;
int roof = 2 * n;
for (j = roof; j > n; j--) {
result = (result * j) / factorialN;
factorialN++;
}
result = re... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.