language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <assert.h>
#define MAX_DIGITS 9
struct ast {
struct ast* left;
struct ast* right;
char num[MAX_DIGITS + 1];
char op;
};
static struct ast* parse(void);
static void parse_space(void);
static struct ast* pars... |
C | #include<stdio.h>
#include<string.h>
/*
int main(void)
{
struct {
int yil;
int ay;
int gun;
} dogum_gunu;
printf("Dogum gununzu ");
printf("gun ay yil gg aa yyyy olarak giriniz: ");
scanf("%d %d %d", &dogum_gunu.gun, &dogum_gunu.ay, &dogum_gunu.yil);
printf("Dogum gununuz: %d/%d/%d", dogum_gunu.gun, d... |
C | #include <stdio.h>
#include "5-7.h"
#include "5-7.h"
int main()
{
matrix a, b;
if (mat_alloc(&a, 3, 3)) {
printf("allocation error\n");
exit(-1);
}
if (mat_alloc(&b, 3, 1)) {
printf("allocation error\n");
exit(-1);
}
mat_elem(a, 1, 1) = 1;
mat_elem(a, 1, 2) = ... |
C | #include "memo.h"
void *create_arr_1d(int n, int type_size) {
void *arr;
arr = (void *)malloc(n * type_size);
return arr;
}
void delete_arr_1d(void *arr) {
free(arr);
}
void **create_arr_2d(int nr, int nc, int type_size) {
void **mat;
mat = malloc(nr * sizeof(void *));
mat[0] = (void *)m... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* struct.c :+: :+: :+: ... |
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 <string.h>
union un{
int a;
int b;
char c;
};
int main(){
union un x;
x.a=-7;
printf("%d\n", a.a);
x.b=10;
printf("%d\n", x.b);
x.c='c';
printf("%c\n", x.c);
printf("\n%d %d %c", x.a, x.b, x.c);
} |
C | #include <stdio.h>
void funcPrint(char *pstring);
int main(void){
funcPrint("hola mundo Cruel");
return 0;
}
void funcPrint(char *pstring){
printf("%s\n",pstring);
}
|
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* exit_func.c :+: :+: :+: ... |
C | /*
Tommy Frometa
tfrometa@albany.edu
*/
/*
This file has the main functionalities of the project. It handles many errors,
gets input from the user and process it, and call functions accordinly.
*/
#include "shellFunctions.h"
#include "input.h"
//(main)
int main(int argc, char* argv[]) {
//Checking for wrong number o... |
C | #include "graphics.h"
#include <math.h>
int main(void) {
int i;
for (i = 0; i < 6; i++) {
drawLine(50, 50 + (i * 25), 350, 50 + (i * 25));
}
drawRect(50, 50, 300, 250);
drawRect(150, 250, 100, 100);
for (i = 0;i <5;i++){
drawLine(50+(i*60),50,50+(i*60),175);
}
drawString... |
C | // Function to find 2nd min and max elements of an array
#include <stdio.h>
void maxmin(int array[20], int n)
{
int i,j,swap,position,max2,min2;
for(i=0;i<(n-1);i++)
{
position = i;
for(j=i+1; j<n ;j++) {
if(array[position]>array[j])
position = j;
}
if(position!=i)... |
C | //**************************************************************************** /
// */
// #' ,#, # # #. .`# #==, .*. + + + */
// ~~~CREATED~~~ # # # # # # # *.* # # # *._.* + ... |
C | /*
* Filename: preprocessor2.c
* Created Date: Sunday, June 3rd 2018, 9:37:12 am
* Author: vrushb bayas
* @description
* Accept one string and two characters replcae first charater with second character in the string
* Copyright (c) 2018 Your Company
*/
#include <stdio.h>
#include <string.h>
//function decl... |
C | #ifndef ROM_MANAGEMENT_H
#define ROM_MANAGEMENT_H
#include <stdint.h>
/* Size of the ROM eeprom used on a WD hard disk drive. */
#define ROM_IMAGE_SIZE 256 * 1024
#define ROM_IMAGE_BLOCK_SIZE 64 * 1024
/* Maximum number of rom block headers found at the start of a rom image. */
#define NUMBER_OF_HEADERS... |
C | #include <string.h>
#include <openssl/md5.h>
#include <mpi.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#define BUFF_SIZE 50 // Максимальная длина обрабатываемой строки
#define ALPH_SIZE 100
#define BENCHMARK
// #define SYNC
int alphabet_length, wanted_length;
char alphabet[ALPH_SIZE];
int thf[BUFF_SI... |
C | /*
* bolt.c
*
* Created: 24.02.2014 09:59:36
* Author: JanGerd
*/
#include "drivers/bolt_drv.h"
static uint8_t bolts;
void bolt_drv_init(void){
BOLTS_PxDIR |= (BOLT_1 | BOLT_2);
BOLTS_PxOUT |= (BOLT_1 | BOLT_2);
bolts = (BOLT_1 | BOLT_2);
}
void bolts_up(unsigned char boltv){
boltv &= 0x03;
bolts |= bolt... |
C |
//Thomas Sanchez
//lab9
//05-08-20
// lab9 changes: PRODUCE MIPS CODE add strings
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <string.h>
#include "ast.h"
#include "emit.h"
char * Cur_func;
static int GLABEL = 0;
char * genlabel()
{ char s[100];
char *s1;
sprintf(s,"_L%d",GLABEL++)... |
C | #include<stdio.h>
int main()
{
int n,i,j;
scanf("%d",&n);
int list[n],max[n];
for(i=0;i<n;i++)
{
scanf("%d",&list[i]);
max[i]=1;
}
for(i=1;i<n;i++)
{
for(j=0;j<i;j++)
{
if(list[j]<list[i]&&max[j]>=max[i])
max[i]=max[j]+1;
... |
C | #include"graph.h"
void CreateGraph(Graph *pg)
{
int i = 0, j = 0;
while (i < MAXGRAPH)
{
pg->vertices[i] = '0';
i++;
}
for (i = 0; i < MAXGRAPH; i++){
for (j = 0; j < MAXGRAPH; j++)
pg->edges[i][j] = 0;
}
pg->size = 0;
} //end function CreateGraph
void ClearGraph(Graph *pg)
{
int i... |
C | #include<stdio.h>
#include<math.h>
#define ERROR -1
int atoi(char *astr) {
int isvalid = 1;
char c;
int i = 0;
int out = 0;
int isminus = 0;
c = astr[0];
if (c == '-') {
isminus = 1;
i++;
}
while(c = astr[i++]){
if ((c > '9') || (c < '0')) {
isva... |
C | #ifndef MXCHARSET_H
#define MXCHARSET_H
#include "MxCommon.h"
/**
* Decodes a code point from UTF-8.
*
* Converts the first character in a UTF-8 sequence into a Unicode code point.
*
* \param str an UTF-8 bytes sequence [IN]
* \param pwc address of a location to store the code point [OUT]
*
* \return the number of byt... |
C | #pragma once
#include <type/size_t.h>
extern size_t strlen(const char* str);
extern char *strcpy(char *s1, const char *s2);
extern int strcmp(char* str1, char* str2);
extern char * strcat(char *dst, const char * src);
extern void* memcpy(void *dst, const void *src, size_t count);
extern void* memset(void *dst, char ... |
C | /*
* Garrett Low
* basic window - practice raylib
*/
#include "raylib.h"
int main(void) {
const int width = 800;
const int height = 450;
InitWindow(width, height, "GRL - basic window");
SetTargetFPS(60);
while (!WindowShouldClose()) {
BeginDrawing();
ClearBackground(... |
C |
#include "definitions.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "read_files.h"
#include "profiles.h"
#include "exit_program.h"
#include <string.h>
#include "login.h"
#include "forgot_password.h"
#include "new_acc.h"
#include <conio.h>
#include "definitions_2.h"
#include "... |
C | struct foo1
{
struct bar1
{
int x;
};
int y;
};
union foo2
{
struct bar2
{
int x;
};
int y;
};
int main()
{
struct foo1 s;
union foo2 u;
s.y=1;
s.x=2;
u.y=1;
u.x=2;
return 0;
}
|
C | #include <stdio.h>
void main()
{
int n, temp;
printf("Usage of continue statement : ");
scanf("%d %d", &n, &temp);
for(int i = 0; i< n; i++) {
if (i == temp) continue;
printf("%d ", i);
}
printf("\n");
printf("Usage of break statement : ");
scanf("%d %d", &n, &temp);
for(int i = 0; i< n; i++) ... |
C | #ifndef _COORD_H_
#define _COORD_H_
#include <stdio.h>
#include <unistd.h>
/*
* Definitions des constantes
*/
#define COORD_VIDE coord_vide()
/*
* Definition des structures
*/
typedef struct coord_s
{
int x ; /* abscisse case : # colonne */
int y ; /* ordonnee case : # ligne */
off_t pos ; ... |
C | #include <stdio.h>
int main(){
int i;
int sum=0;
for(i=1;i<=100;i+=2){
sum+=i;
}
//printf("%d\n",(1+99)*50/2);
printf("%d\n",sum);
return 0;
}
|
C | /*
** resources.c for in /Bomberman/bourda_j
**
** Made by BOURDALE Jules
** Login <bourda_j@etna-alternance.net>
**
*/
#include "./resources.h"
/**
* @brief Set the resource root dir to automatic load all the resources
*
* @warning Supported only on POSIX OS (MacOS / Linux)
*
* @note This must b... |
C | #include <unistd.h>
int ft_putchar(char c)
{
write(1, &c, 1);
return 0;
}
void ft_print_alphabet()
{
int i = 0;
char alphabet[] = "zyxwvutsrqponmlkjihgfedcba";
while (alphabet[i] != '\0')
{
char x = alphabet[i];
ft_putchar(x);
++i;
}
}
int main()
{
ft_print_alphabet();
return 0;
} |
C | #include<stdio.h>
int main()
{
int n,i,m;
printf("Enter the number\n");
scanf("%d",&n);
while(n!=0)
{
m=n%10;
n=n/10;
if(m%2!=0)
printf("%d",m);
}
return 0;
}
|
C | #include<stdio.h>
#include<stdlib.h>
struct Node
{
struct Node *left,*right;
int num;
};
struct Node *start;
struct stackNode
{
struct Node *ptr;
struct stackNode *next;
};
struct stackNode *stackStart;
void push(struct Node *elem)
{
struct stackNode *t;
t=(struct stackNode *)malloc(sizeof(struct stackNode));
t->ptr... |
C | #include <syslog.h>
#include <sys/resource.h>
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/sysinfo.h>
#include <unistd.h>
#include <signal.h>
#include <errno.h>
#include <time.h>
#define MB 1024*1024
#include <stdio.h>
#include <stddef.h>
/* a ub... |
C | #include <stdio.h>
int main(void)
{
double heading;
printf("Enter a compass heading (0.0-360.0 degree)> ");
scanf("%lf",&heading);
if (heading<0.0)
printf("Error--negative heading (%.1f): must be between 0 and 360\n",heading);
else if (heading<90.0)
printf("The bearing is north %.1f degrees east\n",he... |
C | #include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/wait.h>
#include <sqlite3.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <termios.h>
#include <stdint.h>
#include "terminal-code.h"
#include "db.h"
int init_tty(int fd);
/**
... |
C |
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
void first()
{
int
size = 0,
i, j;
printf("Введите размер квадрата\n");
scanf("%d", &size);
for (i = 0; i < size; i++)
{
for (j = 0; j < size; j++)
{
if (i==0 || i==size-1)
... |
C | #include "./inc/main.h"
/**
* @defgroup privRs232Vars Private Main RS-232 Variables
*/
volatile int RX_INT_count = 0;
char test_buffer_PC[60];
char *putPC_ptr, *getPC_ptr;
bool put_status_PC, get_status_PC;
bool AC2PC_RX_flag = FALSE;
/**@}*/
/*
* main.c
*/
int main(void) {
WDTCTL = WDTPW | WDTHOLD; // Stop w... |
C | #define _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_DEPRECATE
#include "helpers.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*POLE S TYPMI VOJAKOV, KTORYCH SI MOZE HRAC VOLIT*/
extern Vojak TypyVojakov[] = {
{"Sermiar", 3,3,4,"warrior"},
{"Lukostrelec", 4,4,3,"rogue"},
{"Kopijnik", ... |
C | #include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/jiffies.h>
#include <linux/utsname.h>
void get_time(void);
void getSystemInfo(void);
typedef struct{
int ID;
char *NAME;
int AGE;
}Student;
int i;
int countS=-1;
Student arrStudent[10];
Student createStudent(int id, ch... |
C | /*
To compile:
gcc -O3 -o mandelbrot mandelbrot.c -lm
To create an image with 4096 x 4096 pixels (last argument will be used to set number of threads):
./mandelbrot 4096 4096 1
*/
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int writeMandelbrot(const char *fileName, int widt... |
C | #include<stdio.h> //Binary Search
#include<stdlib.h>
#define size 10
void swap(int *a,int *b)
{
int temp;
temp=*a;
*a=*b;
*b=temp;
}
void sort(int *a)
{
for(int i=0;i<size-1;i++)
{
for(int j=0;j<size-i-1;j++)
... |
C | #include <stdio.h>
#include "student.h"
void getList(Student astu[],int number);
int save(Student astu[],int number);
int main()
{
int number = 0;
printf("ѧ\n");
scanf("%d", &number);
Student *astu = (Student *)malloc(number * sizeof(int));
//Student astu[number];//c99ֱӿ֣֧C99ַֻʽǵҪͷڴ
getList(astu, number);
if (sa... |
C | /*
** EPITECH PROJECT, 2018
** bootstrap
** File description:
** server2
*/
#include "server.h"
#include <netinet/in.h>
#include <arpa/inet.h>
#include <signal.h>
void close_socket(server_t *server)
{
client_t *current;
client_t *tmp;
if (!server)
return;
current = server->current;
while (current != 0){
tmp... |
C | #include "IA.h"
int theIAchoice(int lin,int col,int Array[lin][col],int level)
{
int i;
int place;
int choice = rand()%2;
int err = rand()%100;
int err2 = rand()%300;
for(i=0;i<col;i++)
{
if(Array[lin-1][i] == 10)
place = i;
}
if(level == 1)
{
if(Array[lin-2][place] != 0)
{
if(choice == 0)
{... |
C | /*
* Starter producer/consumer program using a shared buffer.
*
*/
#include <pthread.h>
#include <stdio.h>
#include <time.h>
int main(int argc, char *argv[]);
void * producer(void * arg);
void * consumer(void * arg);
void thread_sleep(unsigned int ms);
#define BUFSLOTS 10
/*
* Structure used to ... |
C | #include <cs50.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
//test edit
string secretMessage;
int code;
//another test edit
int main(int argc, string argv[])
{
if(argc == 2)
{
code = atoi(argv[1]);
printf("The code is %i\n", code);
secretMessage = get_string("... |
C | #include <stdio.h>
#include <stdlib.h>
int main(int argc, char* argv[]){
int x,y,z,m;
x=atoi(argv[1]);
y=atoi(argv[2]);
z=atoi(argv[3]);
m = z;
if (y<z) {
if(x<y)
m=y;
else if (x<z)
m=y;
} else {
if (x>y)
m=y;
else if (x>z)
m = x;
}
printf("Middle number is: %d\n",m);
}
|
C | #include <stdlib.h>
#include <stdio.h>
#include <wctype.h>
void read_file(char* file_name, char* options){
int character_count = 0;
int whitespace_count = 1;
int linebreak_count = 0;
FILE *file_to_read = NULL;
if( file_name == NULL ) {
printf( "read_file: invalid file_name" );
return;
}
if( o... |
C | /*
* libsc - Relational memory management
*
* Copyright 2011 Nathaniel McCallum <nathaniel@themccallums.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of t... |
C | #include <stdio.h>
main() {
int c;
int is_space = 0;
while((c = getchar()) != EOF) {
if(c == ' ' && !is_space) {
is_space = 1;
putchar(c);
}else if(c!= ' ') {
is_space = 0;
putchar(c);
}
}
}
|
C | // subshell.c
// author: Jann Horn
// source: https://bugs.chromium.org/p/project-zero/issues/detail?id=1712
#define _GNU_SOURCE
#include <unistd.h>
#include <grp.h>
#include <err.h>
#include <stdio.h>
#include <fcntl.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <sched.h>
#include <sys/wait.h>
int main() {... |
C | #include <stdio.h>
int main(void)
{
int c, v, i, x, j, menor, maior=0, n[999999]={0}, m[3];
scanf("%d%d", &c, &v);
for(i = 0; i < c; i++)
for(j = 0; j < v; j++)
{
scanf("%d", &x);
n[i] += x;
}
for(i = 0; i < c; i++)
if(n[maior] < n[i])... |
C | #include "dog.h"
/**
* _strcpy - copy pointers
* @dest: destination
* @src: string to copy
* Return: the pointer to dest
*/
char *_strcpy(char *dest, char *src)
{
int i;
for (i = 0; src[i] != 0; i++)
{
dest[i] = src[i];
}
dest[i] = '\0';
return (dest);
}
/**
* _strlen - Count the maximum number of a a... |
C | #include <stdlib.h>
#include <stdio.h>
#include "parse.h"
#include "helpers.h"
static Parser* newParser(int argumentsCount, char** arguments) {
Parser* parser = calloc(1, sizeof(Parser));
if (argumentsCount == 2 && stringsEqual(arguments[1], ARGUMENT_SWITCH_DEBUG))
parser->debugMode = true;
... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<stdbool.h>
#include<limits.h>
typedef long long ll;
enum{ P =(ll)1e9 + 7 };
enum{ N = 22 };
enum{ M = 11 };
enum{ K = 4 };
enum{ milion=(ll) 1e6};
ll p[N][M][K];
ll pref[N][1 << M][M * K];
enum{ inv1e6 = 14285700... |
C | #include <stdlib.h>
#include "mod_core.h"
#include "mod_http.h"
#include "mod_rtsp.h"
/*
typedef struct net_module {
(void)(*process_request)(int fd);
}
*/
typedef struct module_node {
int port;
net_module *module;
struct module_node *next;
} module_node;
static module_node *header = NULL, *tail = NULL;
void ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
char * dna_strand(const char * dna)
{
if (dna == NULL || strlen(dna) == 0)
return NULL;
int length = strlen(dna);
printf("size: %d\n", length);
char * complement = malloc( sizeof(char) * length);
int i;
for (i = 0; i != length; i++) {
if ... |
C | #include<stdio.h>
int main(){ int i; for(i = -4; i <= 86; i += 18) printf("%d\n", i); } |
C | /* array.h - Foundation library - Public Domain - 2013 Mattias Jansson
*
* This library provides a cross-platform foundation library in C11 providing basic support
* data types and functions to write applications and games in a platform-independent fashion.
* The latest source code is always available at
*
... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
/* Functions to swap byte order from little endian to big endian. Required
* because Kindle is big endian, but x86 is little endian.*/
#define ByteSwap16(n) \
( ((((unsigned int) n) << 8) & 0xFF00) | \
((((unsigned int) n) >> 8) & 0x00FF) ... |
C | /**
* _atoi - Convert string to an integer.
* @s: Pointer to a character string.
*
* Return: void.
*/
int _atoi(char *s)
{
int sign;
unsigned int num;
char *temp;
temp = s;
num = 0;
sign = 1;
while (*temp != '\0' && (*temp < '0' || *temp > '9'))
{
if (*temp == '-')
sign *= -1;
temp++;
}
if (*tem... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
//#define BitIsSET '*'
//#define BitIsSET '#'
#define BitIsSET '@'
//#define BitIsSET ' ' /* special invers Darstellung */
int main(int argc, char *argv[])
{
int width,new_width;
int height;
int anz;
int hexwert;
int ii, kk;
int bl... |
C | #include <stdio.h>
int reverseNum(int n)
{
int revNum = 0;
revNum = (n % 10) * 100;
revNum += ((n / 10) % 10) * 10;
revNum += (n / 100);
return revNum;
}
int main(void)
{
int a, b;
scanf("%d %d", &a, &b);
a = reverseNum(a);
b = reverseNum(b);
if (a > b)
printf("%d", a);
else
p... |
C | #include "fraction.h"
#include "math.h"
#include <stdio.h>
#include <stdlib.h>
Fraction add ( Fraction a, Fraction b ) {
return (Fraction) { a.num * b.den + a.den * b.num, a.den * b.den };
}
Fraction multiply ( Fraction a, Fraction b ) {
return (Fraction) { a.num * b.num, a.den * b.den };
}
Fraction... |
C | /*
* File: MatrixMath.c
* Author: Stephanie Lin
*
* Created on April 19, 2019, 2:21 PM
*/
#include <stdio.h>
#include <stdlib.h>
#include "MatrixMath.h"
/*
*
*/
static float MatrixDeterminant2x2(float mat[2][2]) {
float a;
float b;
float c;
// Does cross multiplication of 2x2 matrix
... |
C | #include "path_planning.h"
//to get pos in node array based on x, y
// pos = y * 30 + x
//to get x, y in terms of pos
// y = pos / 30
// x = pos % 30
//note that when accessing, for example, current_map->map[i][j]
//is equivalent to (word) current_map[i][j]
void bfs(maze_map* current_map, int* target_point) {
in... |
C | /*
* conv.c
*
* Created on: May 1, 2013
* Author: Rafat Hussain
*/
#include "conv.h"
int factorf(int M) {
int N;
N = M;
while (N%7 == 0){
N = N/7;
}
while (N%3 == 0){
N = N/3;
}
while (N%5 == 0){
N = N/5;
}
while (N%2 == 0){
N = N/2;
}
return N;
}
int findnext(int M) {
int N;... |
C | #include "lab6.h"
int main(void)
{
// Declare all variables
Student * students;
students = createArray();
if (students != NULL)
{
// Print out the result
printf("The average GPA of %d students is %.2f.\n\n", getNumberOfStudents(students), getAverageOfGPA(students));
... |
C | #include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <unistd.h>
#include <string.h>
int main() {
int threads = 16;
int msg_size = 2048*64;
size_t size = threads * msg_size;
int fd = open("/tmp/testmmap", O_RDWR | O_CREAT, S_IRUSR | S_... |
C | //string length
#include<stdio.h>
#include<string.h>
int main()
{
char str[50];
int i=0;
printf("Enter the string:\n");
gets(str);
while(str[i]!='\0')
{
i++;
}
printf("string length is %d\n",i);
}
|
C | /* Ex05_01.c */
// if 문 써보기
#include <stdio.h>
int main(void)
{
int score;
printf("점수를 입력하세요. : ");
scanf("%d", &score);
if( score < 60 ) {
printf("%d점은 불합격입니다.\n", score);
}
if ( score >= 60 ) {
printf("%d점은 합격입니다.\n", score);
}
return 0;
}
|
C | /******************************************************************************
* File: TimeDaemon.cc
* Aufgabe: the daemon code
* Autor: M. Thaler, ZHW
* Datum: Februar 2000 (Rev. 8/2004, Rev. 3/2008)
* History: 29/03/2008 M. Thaler: single connection socket server
**************************************... |
C |
#include <pic.h>
void eeprom_str_write(unsigned char *ptr, unsigned char address, unsigned char length)
{
unsigned char i=0;
while(i!=length)
{
eeprom_write(address+i,*(ptr+i));
i++;
}
}
void eeprom_str_read(unsigned char *ptr, unsigned char address, unsigned char length)
{
unsigned char i=0;
while(i!=len... |
C | #include "kernel_stats.h"
double get_current_time() {
struct timeval tp;
struct timezone tzp;
gettimeofday(&tp,&tzp);
return ((double) tp.tv_sec + (double) tp.tv_usec * 1.e-6 );
}
void print_timestep(uint8_t type, double collected_time) {
int rank;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
if(rank... |
C | #include "burger.h"
bool interrupt = false; /* Flag which will be set to true when the threads should terminate themselves */
/* Define the counter for available burgers in the rack */
uint8_t burger_count;
int main ()
{
//uint8_t burger_count = 0;
char s[1000];
FILE *fptr;
if ((fptr = fopen("test_cases.txt", "... |
C | /*
* CCD.c
*
* Created on: 2013-12-2
* Author: lvniqi
* Email: lvniqi@gmail.com
*/
/*
棡ʹʱdzСģ
ʹǰʼ
Ҫ ֤ݲ!
ͬʱ ֹ
*/
#ifndef LINKLIST_H_
#define LINKLIST_H_
#include <pthread.h>
#include <stdbool.h>
#include <string.h>
#include<stdlib.h>
#include<stdio.h>
#include "Sequeue.h"
#define DEBUG
... |
C | #include <stdio.h>
#include <cs50.h>
string cardType(long num)
{
int firstNumber, i = 1;
do
{
firstNumber = num%10;
num = num / 10;
i++;
}
while(num / 10 != 0);
if(firstNumber == 3 && i == 15)
{
return "AMEX";
}
else if(firstNumber == 4 && (i == ... |
C | /* receivemq.c */
/* message queue example */
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#include <stdio.h>
#include <string.h>
#define BUFSIZE 16
#define QKEY (key_t)0111
struct msgq_data {
long type;
char text[BUFSIZE];
} ;
struct msgq_data recv_data;
int main()
{
int qid, len;
if ((qid = msgget... |
C | //
// main.c
// tree
//
// Created by 김지우 on 2021/05/25.
//
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
typedef struct TreeNode {
int data;
struct TreeNode *left, *right;
} TreeNode;
TreeNode* CreateTree(void){
TreeNode* node = (TreeNode*)malloc(sizeof(TreeNode));
... |
C | #include <stdio.h>
int factorial(int num){
int result = 1;
for (int i = 1; i <= num; i++){
result = result* i;
}
return result;
};
int fibo(int num){
if(num==0)
return 0;
if(num==1)
return 1;
return fibo(num-1)+fibo(num-2);
};
int fibonacci(int num){
int fibo = 0;
for (int i = 1; i <= num; ++i){
fib... |
C | #include <stdio.h>
int main(void)
{
int i, n;
int binary[32] = {0};
// 최대 32 자리 이므로 binary 배열 32개를 만들어주고
printf("숫자를 입력하세요 : ");
scanf("%d", &n);
for( i = 0 ; i < 32 && n > 0 ; i++ ){
// n을 계속 2로 나눠준 값을 저장하기 때문에
// n이 0 보다 작아지면 변환이 끝난것 이기 때문에
// i가 32보다 작고 n 이 0보다 클때만 for문을 반복해준다.
b... |
C | #include <stdio.h>
int main (void)
{
printf ("MMMMMMMMM\n");
printf (" M \n");
printf (" M \n");
printf (" M \n");
printf (" M \n");
printf (" M \n");
printf (" M \n");
printf (" M \n");
printf ("MMMMMMMMM\n");
printf (" \n");
printf ("A \n");
print... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* get_nl.c :+: :+: :+: ... |
C | #include<stdio.h>
#include<string.h>
#include<stdlib.h> //For using malloc
#include "modifiedDay1.h"
#include "day3.h"
node* parseTree(char post_exp[])
{
int max = strlen(post_exp);
int stackPointer = -1;
node* stack[max+1];
for(int i = 0; i < max; i++)
{
switch(post_exp[i])
{
... |
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 "libmx.h"
// Function works with NULL terminated array
void mx_print_strarr(char **arr, const char *delim)
{
if (arr != NULL || delim != NULL || *arr != NULL)
{
for (int i = 0; arr[i] != NULL; i++)
{
mx_printstr(arr[i]);
if (arr[i + 1] != NULL)
m... |
C | /**
*--------------------------------------------------------------------\n
* HSLU T&A Hochschule Luzern Technik+Architektur \n
*--------------------------------------------------------------------\n
*
* \brief terminal with command line parser
* \file
* \author Christia... |
C | #include "integral_channels_for_pedestrians.h"
#include <math.h>
#include <string.h>
#include "utility.h"
#include "image_processing.h"
#include "color_converting.h"
#include "angle_bin_compute.h"
#include "helpers/utility_data_structure.h"
static float angleBinVectors[NUMBER_BINS][2];
static void initAngleBinComput... |
C | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
typedef struct SYMBOLTABLE
{
char name[10];
int addr;
int val;
}SYMBOLTABLE;
SYMBOLTABLE st[10];
int lc=1;
int i,p,r,c,d,q,n,sym_ptr=1;
char b1[10],b2[10],b3[10],b4[10],b5[10],b6[10],b7[10],buffer[80];
char IS[][6]={"STOP","ADD","SUB","MULT",... |
C | #ifndef UPEM_MORPHING_QUADRILATERAL
#define UPEM_MORPHING_QUADRILATERAL
/**
* File: quadrilateral.h
* Operations on quadrilaterals formed by adjacent triangles pairs.
*
* Author:
* Pacien TRAN-GIRARD
*/
#include <stdbool.h>
#include "common/geom.h"
#include "morpher/trianglemap.h"
/**
* Function: quadrilate... |
C | ////////////////////////////////////////////////////////////////////////////////
//
// File : crud_client.c
// Description : This is the client side of the CRUD communication protocol.
//
// Author : Patrick McDaniel
// Last Modified : Thu Oct 30 06:59:59 EDT 2014
//
// Include Files
// Project ... |
C | #include <stdio.h>
int jia(int v1, int v2) {
return v1 + v2;
}
int jian(int v1, int v2) {
return v1 - v2;
}
int dynamicFunc(int v1, int v2, int (*funcP)(int, int)) {
return funcP(v1, v2);
}
void testFuncPointer() {
printf("10+5=%d\n", dynamicFunc(10, 5, jia));
printf("10-5=%d\n", dynamicFunc(10, 5, jian));
} |
C | /**
* Author: Lanqing Ye
* Date: 2019-08-25
*/
/*
Input: 10
Output: 4
Explanation: There are 4 prime numbers less than 10, they are 2, 3, 5, 7.
*/
int countPrimes(int n){
if(n<=2) return 0;
int num = 0;
int i,j;
for(i = 2;i<n;i++){
int tmp=(int)sqrt(i);
for(j=2;j<=tmp;j++){
... |
C | /*
* 파일명: foo.c
* 내용: InFoo 함수를 정의한다.
* InFoo 함수는 두 정수를 매개변수로 받아, 덧셈 결과를 반환한다.
*/
#include "libfooboobar.h"
int InFoo(int num1, int num2) {
printf("You are in Foo!!!\n");
printf("Foo returns the results of addition.\n");
return num1 + num2;
}
|
C | #include<stdio.h>
#include<conio.h>
int main()
{
int i,num,n=0,p=0,z=0;
printf("Enter the number of elements:\n");
scanf("%d",&num);
int a[num];
srand(time(NULL));
for(i=0;i<num;i++)
{
a[i]=rand() % 100-50;
}
printf("Array elements are:\n");
for(i=0;i<num;i++)
{
printf("a[%d]=> %d\n",i,a[i]);
... |
C | #include <stdio.h>
int main(){
int vetor[4];
vetor[0] = 'a';
vetor[1] = 6;
vetor[2] = 'H';
vetor[3] = 39;
int i;
for(i=0; i<4; i++){
printf("(int) (int) %d\n", vetor[i]);
}
for(i=0; i<4; i++){
printf("(char) (int) %c\n", vetor[i]);
}
char vet[4];
vet[0] = 'a';
vet[1] = 6;
vet[2] = 'H';
vet[3] = ... |
C | #define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#if 0
void cout_multiplication_table(int x) {
for (int i = 1; i <= x; i++) {
for (int j = 1; j <= i; j++) {
printf("%02d*%02d=%3d ", j, i, j * i);
}
printf("\n");
}
}
int main() {
int i;
printf("912");
scanf("%d", &i);
cout_multiplication_table(i);... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MTHASH(v) ((((long) v) >> 8) & 0xffff)
#define MEMTSTSZ (1 << 18)
#define MTHASHSZ (1 << 16)
#define MTBTLEN 5
struct memtst {
long *mem;
long n;
long bt[MTBTLEN];
int freed;
};
static struct memtst *memtst; /* memtst records */
static int m... |
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.