language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | /**\file parser.c
* \brief Definição de métodos para parser de linha de comando no UdpTester.
*
* \author Alberto Carvalho
* \date June 26, 2013
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <defines.h>
#include <tools/parser.h>
#include <tools/debug.h>
#include <netinet/in.h>
#includ... |
C | #include <sys/types.h>
#include <sys/socket.h>
#include <stdio.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/un.h>
#include <unistd.h>
#include <pthread.h>
#define MASTER 100
#define SLAVE 200
int gsockfd; // global sock fd.
int REG_FLAG = 0; // flag used for user registration validation.
char g_n... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
int n, c;
int C[100], l = 0; // put huffman code.
typedef struct node{
int data;
int weight;
struct node *father;
struct node *left;
struct node *right;
}node;
void select2(int *a, char *A, int Flag) //select already has.
{
int flag1 = 0,... |
C | #include <msp430.h>
#include "LCD_I2C.H"
/**
* main.c
*/
int main(void)
{
WDTCTL = WDTPW | WDTHOLD; // stop watchdog timer
lcd_init(0x27);//Initialize the LCD as slave with I2C Slave address as 0x27
set_backlight();//Turn on the backlight
lcd_setcursor(0,2);//Set the position of the Cursor
lcd_prin... |
C | #include <stdio.h>
#include <math.h>
void main()
{
float a, b, c, d, r1, r2;
printf("enter parameters of the first circle\n");
scanf("%f %f %f", &a, &b, &r1);
printf("enter parameters of the second circle\n");
scanf("%f %f %f", &c, &d, &r2);
if((r1<=0)||(r2<=0))
{printf("error");
return;}
else if((sqrt(pow((c-a... |
C | #include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
int main(int argc,char** argv)
{
char * arg[]={"ls","-l","monfic",NULL};
/* printf("avant exec \n");
execv("/bin/ls",arg);
printf("après exec \n");
chmod("monfic",S_IRWXU);
chmod("monfic",S_... |
C | #include "fuseLib.h"
#include "myFS.h"
#include <stdlib.h>
#include <string.h>
MiSistemaDeFicheros miSistemaDeFicheros;
#define USO "Uso: %s -t tamDisco -a nombreArchivo -f 'opciones fuse'\n"
#define EJEMPLO "Ejemplo:\n%s -t 2097152 -a disco-virtual -f '-d -s punto-montaje'\n"
int main(int argc, char **argv) {... |
C | #include<stdio.h>
int main(){
int m,k,day=0;
scanf("%d%d",&m,&k);
while (m>0)
{
m--;
day++;
if (day%k==0)
{
m++;
}
}
printf("%d",day);
} |
C | #include<stdio.h>
void main()
{
int num;
printf("enter the integer");
scanf("%d",&num);
if(number%2==0)
{
printf("%d" is even",num);
}
else
{
printf("%d is odd",num);
}
return 0;
}
|
C | #include<stdio.h>
#include<math.h>
int main()
{
int i,j,k,t,s,sg,fg,d;
float m,n;
scanf("%d",&t);
for(i=0;i<t;i++)
{
scanf("%d%d%d%d%d",&s,&sg,&fg,&d,&k);
n=(d*180)/k;
m=s+n;
if((fabs(m-sg))<(fabs(m-fg)))
{
printf("SEBI\n");
}
else if((fabs(m-sg))>(fabs(m-fg)))
{
printf("FATHER\n");
... |
C | /*
Solve x^3-3x+1=0 correct to 3 significant digits using the Regular Falsi Method.
*/
#include<stdio.h>
#include<math.h>
float fun(float x)
{
return(x*x*x-3*x+1);
//return (x*pow(2.718,-x)-3*x+7);
}
main()
{
float x,x1,x2,f,f1,f2,e=0.0001;
printf("Enter two guess values\n");
scanf("%f %f",&x1,&... |
C | #include "biblioH.h"
#include "entreeSortieH.h"
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* retourne un entier (clef) à partir du nom de l'auteur */
int fonctionClef(char* auteur){
int somme = 0;
for(int i = 0; auteur[i]!='\0'; i++){
somme += (int)auteur[i];
... |
C |
// c program to find largest element in the array
#include <stdio.h>
int main()
{
int n, i, a[100], max;
printf("enter the size of array\n");
scanf("%d", &n);
printf("enter the elemrent of the array\n");
for (i = 0; i <= n; i++)
{
scanf("%d", &a[i]);
}
max = a[0]; //initialise ... |
C | /*
Copyright 2015 Google Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in wri... |
C | #ifndef VARIABLE_H_
#define VARIABLE_H_
#include "str.h"
#include "error.h"
#include "tabSym.h"
#include <stdbool.h>
/*
* Funkce pro ziskani hodnoty promenne
* @param tVariablePtr[in] promenna pro prevedeni
* @return (int|double|bool)
*/
#define getVarVal(var) \
((var->type == VAR_TYPE_INT) ? (var->data.intVal) :... |
C | // COMP1521 18s2 mysh ... command history
// Implements an abstract data object
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "history.h"
// This is defined in string.h
// BUT ONLY if you use -std=gnu99
//extern char *strdup(const char *s);
// Command History
// array of command lines
// each i... |
C | /*
* event.c
*
* Author: kayekss
* Target: unspecified
*/
#include <stdbool.h>
#include <stdint.h>
#include "ctime.h"
#include "event.h"
// Clear event entry
inline void event_clear(event_t* ev) {
ev->on.h = 0;
ev->on.m = 0;
ev->off.h = 0;
ev->off.m = 0;
ev->mask = ~0;
}... |
C | // Dang Lam San 20170111
#include <stdio.h>
#include <math.h>
int main()
{
float a, b, c;
printf("Nhap vao 3 he so\n");
scanf("%f%f%f", &a, &b, &c);
if (a == 0)
{
if (b == 0)
{
if (c == 0)
{
printf("Phuong trinh co vo so nghiem");
... |
C | #include<stdio.h>
int main (void) {
int v1[10], v2[10], v3[10], cnt, num;
printf(" ************************************************ \n");
printf(" **Esse programa calcula multiplicao de vetores** \n");
printf(" ************************************************ \n\n");
printf("Digite os valore... |
C | #pragma once
#include <GL/glut.h>
typedef unsigned char ubyte;
struct RGB {
ubyte r;
ubyte g;
ubyte b;
ubyte gray() {
return 0.299 * r + 0.587 * g + 0.114 * b;
}
bool isGray() {
return r == g && g == b;
}
};
extern RGB BLACK;
extern RGB WHITE;
bool operator == (const RGB& a, const ... |
C | #include <stdio.h>
#define tonum(c)(c >= 'A' && c <= 'Z' ? c - 'A' : c - 'a' + 26)
int main(){
char c;
c = 'B';
printf("%d\n", tonum(c));
return 0;
} |
C | #include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <time.h>
#include <errno.h>
#include <stdint.h>
#include <string.h>
#include <assert.h>
#include "slist.h"
#include "directory.h"
void
storage_init(const char* path)
{
pages_init(path);
directory_init();
}
int
storage_stat(cons... |
C | ///============================================================================
//
// PROJET : PORTABLES 2014
// MODULE : Board.c
// DESCRIPTION : Configuration de la carte
//
//=============================================================================
//===============================================... |
C | /*
** my_printf.c for libmy in /home/kevin/Documents/prog/C/libmy
**
** Made by kevin
** Login <kevin@epitech.net>
**
** Started on Wed Nov 12 11:30:07 2014 kevin
** Last update Wed Nov 12 11:30:07 2014 kevin
*/
#include "my.h"
int my_printf(char *str, ...)
{
char *ret;
va_list ap;
int len;
va_start(ap... |
C | #include "common.h"
/**
* Return an array of size *returnSize.
* Note: The returned array must be malloced, assume caller calls free().
*/
int* majorityElement(int* nums, int numsSize, int* returnSize)
{
int*res = malloc(2 * sizeof(int));
*returnSize = 0;
int i, n1 = 0, n2 = 1, cnt1 = 0, cnt2 = 0;
for (i = 0; i < ... |
C | #include<stdio.h>
#include<stdlib.h>
#include"matrixOp.h"
#include"ArrayOp.h"
int checkDiagonalmatrix(int *mt, int size); //checks is matrix is diagonal
int *createEffArr(int *mt, int n); //creates array parsed from matrix
void printMatrixArray(int *mt,int n); //prints the optimized array in matrix form
int setV... |
C | #include "tower.h"
/*unsigned char tower2[] = {0x00, 0x30, 0x4E, 0x42, 0x22, 0x22, 0x3C, 0x00};
unsigned char tower3[] = {0x00, 0x3C, 0x24, 0x42, 0x42, 0x42, 0x3C, 0x00};
unsigned char tower1[] = {0x00, 0x58, 0x18, 0x66, 0x66, 0x18, 0x1A, 0x00};*/
unsigned char mortar_bmp[] = {0x00, 0x30, 0x5E, 0x6A, 0x32, ... |
C | #include <stdio.h>
#include <limits.h>
#include <string.h>
int main()
{
int number_array[8] = {48, 59, 2, -8, 55, 56, 78, 12};
for (int i = 2; i < 8; i++ ){
if (number_array[i-1] > number_array[i]){
number_array[i] = number_array[i] + number_array[i - 1];
number_array[i - 1] = num... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* pile.c :+: :+: :+: ... |
C | #include "timer.h"
static struct timeval _current_time;
static struct timeval _temp_time;
void timer_set(struct timeval* timeout, int msec) {
_temp_time.tv_sec = msec / 1000;
_temp_time.tv_usec = (msec % 1000) * 1000;
gettimeofday(&_current_time, 0);
timeradd(&_current_time, &_temp_time, timeout);
}
int timer_t... |
C | #include "holberton.h"
/**
* append_text_to_file - appends text to a file
* @filename: name of the file
* @text_content: content of the text
* Return: 1 on success, -1 on failure
*/
int append_text_to_file(const char *filename, char *text_content)
{
int file_d, len;
ssize_t size_write;
if (filename == NULL)
... |
C | /*
* Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless requi... |
C | #include "common.h"
#include "parsenum.h"
#define parse_signed(type, unsigned_type, value_type_min, value_type_max) \
ParseNumError strnto## type(const char *nptr, const char * const end, char **endptr, type *ret) { \
char c; \
char ***spp; \
int negative; \
int any, cutlim; \
... |
C | #include "BST.h"
#define _CRTDBG_MAP_ALLOC
#include <crtdbg.h>
BST* bst_create(CmpFunc cmp_func)
{
BST* tree = (BSTNode*)malloc(sizeof(BSTNode));
if (tree == NULL)
return NULL;
tree->cmp_func = cmp_func;
tree->root = NULL;
return tree;
}
static BSTNode* bst_add_in_tree(Pointer data)
{
BSTNode*... |
C | #include <stdio.h>
#include <unistd.h>
#include <semaphore.h>
#include <string.h>
#include <pthread.h>
char buf[64];
sem_t sem;
void *fun(void *args)
{
while(1)
{
sem_wait(&sem);
printf("\nbuf size:%ld character\n",strlen(buf));
}
}
int main()
{
int tid;
pthread_t pth;
if(sem_init(&sem,0,0) < 0)
{
pe... |
C | //-*-c-*-
//#include "linalg.h"
//extern "C"
//{
__kernel void float3add(__global float3 *a, __global float3 *b, __global float3 *dest)
{
int idx = get_global_id(0);
dest[idx] = a[idx] + b[idx];
}
__kernel void float3addequal(__global float3 *a, __global float3 *b)
{
int idx = get_global_id(0);
a[idx] += b[idx]... |
C | /*
** EPITECH PROJECT, 2020
** NWP_myteams_2019
** File description:
** sublistteam_cmd
*/
#include <stdio.h>
#include "my_team.h"
#include "commands.h"
void send_sub_users(int socket, team_t *team)
{
linked_list_t *cursor = team->sub_users;
user_t *user;
char user_id[37];
while (cursor) {
us... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <assert.h>
#include "symbols.h"
#ifndef _IR_BUFFER_H_
#define _IR_BUFFER_H_
/* args_count=2:
* GOTO x
* RETURN x
* ARG x
* PARAM x
* READ x
* WRITE x
* args_count=3:
* LABEL x :
* FUNCTION f :
* x := y
* x := &... |
C | #ifndef PROJECT_H
#define PROJECT_H
#endif // PROJECT_H
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <conio.h> #include "project.h"
/**function to display inter-active menu **/
void Load_menu()
{
int choice;
do
{
printf("\n\n\t\t\t*** Main Menu ***\n\n");
printf("\t\t\t|1| ADD \n");
... |
C | /**
* dictionary.c
*
* Computer Science 50
* Problem Set 5
*
* Implements a dictionary's functionality.
*/
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
#include <memory.h>
#include <ctype.h>
#include "dictionary.h"
/**
* trie to load the dictionary in.
*/
typedef struct _dictionary
{
bool... |
C | //===============================================
#include "GKeyboard.h"
//===============================================
static GKeyboardO* m_GKeyboardO = 0;
//===============================================
GKeyboardO* GKeyboard_New() {
GKeyboardO* lObj = (GKeyboardO*)malloc(sizeof(GKeyboardO));
lObj->Delete... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* append_cmd.c :+: :+: :+: ... |
C |
/*
* minmax.c
* Determine the minimum and maximum values of a group of pixels.
* This demonstrates use of the glMinmax() call.
*/
#include <GL/glut.h>
#include <stdlib.h>
extern GLubyte* readImage(const char*, GLsizei*, GLsizei*);
GLubyte *pixels;
GLsizei width, height;
void init(void)
{... |
C | #include<stdio.h>
#include<conio.h>
#include<math.h>
#define pi 3.14
void main()
{
int a,c;
clrscr();
printf("Enter The Value of Radius of The Circle : ");
scanf("%d",&a);
c=pi*a*a;
printf("\n\nThe Area of Circle is : %d Units",c);
getch();
} |
C | #include <stdio.h>
void drawLinesWithRowCol(int rows, int cols, char character);
int main(void)
{
int rows, cols;
char character;
printf("Enter rows: ");
scanf("%d", &rows);
printf("Enter columns: ");
scanf("%d", &cols);
printf("Enter character: ");
scanf(" %c", &character);
drawLinesWithRowCol(rows, co... |
C | //C program merge to merge two sorted arrays
// It is assumed that user will enter arrays in ascending order
#include <stdio.h>
void merge(int [], int, int [], int, int []);
int main() {
int a[100], b[100], m, n, c, sorted[200];
printf("Input number of elements in first array\n");
scanf("%d", &m);
print... |
C | //290207
//lista 3
//zadanie 1
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int no_ones=0, longest_ones=0, longest_zeros=0;
int len1=0, len0=0;
unsigned int n = 0;
scanf("%ud", &n);
int i=0;
unsigned int m=n/2;
for (i=0; i<32; i++){
if (n%2 != m%2){
if (n%... |
C | #include<poll.h>
#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<sys/types.h>
#include<sys/socket.h>
#include<string.h>
#include<errno.h>
#include<netinet/in.h>
#include<arpa/inet.h>
#define _BACKLOG_ 5
#define _SIZE_ 64
static void usage (const char *proc)
{
printf("%s [ip][prot]\n",proc);
}
stat... |
C | # define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include"game.h"
#include<string.h>
#include<Windows.h>
#include<stdlib.h>
#include<time.h>
void menu()
{
printf("**********************************\n");
printf("*************ɨСϷ***********\n");
printf("***************1.PLAY*************\n");
printf("************... |
C | #include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <string.h>
#include <errno.h>
#include <pthread.h>
/* limits.h defines "PATH_MAX". */
#include <limits.h>
#include "mutexleveldb.h"
#include "perf.h"
#undef PROFILE
#define GETENTRY_THREADS 32
#define GETENTRY_COMMAND "cat output.%d | beegfs-ct... |
C | #include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <signal.h>
int main(void)
{
int id;
int status;
pid_t pid;
printf("Hello world\n");
id = fork();
if (id < 0)
{
printf("Impossible de fork le processus\n");
return (EXIT_FAILURE);
}
while ... |
C | #include <stdio.h>
#include <stdlib.h>
struct stack
{
int size;
int top;
int *st;
};
void create(struct stack *S)
{
S->top=-1;
printf("Enter the size ");
scanf("%d",&S->size);
S->st=(int *)malloc(S->size*(sizeof (int)));
}
void insert (struct stack *S){
scanf("%d",&S->st[++S->top]... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* parsing_colors.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
//Complete the following function.
void calculate_the_maximum(int n, int k) {
int i,j;
int max1=0,max2=0,max3=0;
for(i=1;i<=n-1;i++)
{
for(j=i+1;j<=n;j++)
{
int a=i&j;
int b=i|j;
i... |
C |
/* Probem statement:
* You have a ladder n-steps in height. You can either take one step
* or two steps up the ladder at a time. How can you find out all the
* different combinations up the ladder? Then figure out an algorithm that
* will actually print out all the different ways up the ladder
* Approach:
* ... |
C | #include <stdio.h>
#include <rpm/rpmlib.h>
#include <rpm/rpmts.h>
#include <rpm/header.h>
void printtagdata(const rpmtd atagdata ) {
char* datastr = NULL;
if( !atagdata ) {
printf("NULL POINTER\n");
return;
}
const char* tagname = (atagdata->tag) ?
rpmTagGetName(atagdata->tag) : "!NULLTAG!";
i... |
C | #include "all.h"
#define Max(a,b) (a>b?a:b)
#define Min(a,b) (a<b?a:b)
int32_t Int32Abs(int32_t Data)
{
if(Data<0)
return -Data;
else
return Data;
}
int64_t Int64Abs(int64_t Data)
{
if(Data<0)
return -Data;
else
return Data;
}
float F_Abs(float Data)
{
if(Data<0)
return -Data;
else
return Data;
... |
C | /*
* GccApplication1.c
*
* Created: 12/14/2017 12:20:05 PM
* Author: Student
*/
#include <avr/io.h>
#include <util/delay.h>
#include "lcd_lib.h"
void cycle_1() {
int c;
char b[2];
for(int i =20;i>0;i--) {
LCDGotoXY(0,0);
sprintf(b,"%d",i);
LCDstring(b,2);
_delay_ms(500);
PORTD|=... |
C | /*
Write a program which displays ASCII table. Table contains symbol,
Decimal, Hexadecimal and Octal representation of every member from
0 to 255.
*/
#include<stdio.h>
void DisplayASCII()
{
int i =0;
printf("___________________________________________\n");
printf("Decimal\t|Octal\t|Hexadicimal\t|ASCII\... |
C | /*
You need to implement a versioned stack, i.e. version of stack will increment after each push/pop. Apart from push/pop, implement a method print(n) which would print stack state corresponding to version 'n'. For example:
-> initially stack is empty.
-> Version 1: 11 is pushed
-> Version 2: 8 is pushed
-> version... |
C | /*-------------------------------------------------------------------*/
/* ITS60304 Assignment #1 */
/* C Programming */
/* Student Name: <Balreen Kaur Badesha> <Lakshana Bunghoo> */
/* Student ID: <0319848> <0323400> */
/*-------------------------------------------------------------------*/
#include<stdio.h>
... |
C | #include<stdio.h>
#include<windows.h> //baraye taghyire makane makannoma
void gotoxy(int x, int y)
{
COORD coord = {x, y};
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
}
#include <time.h> //estefade az tabe delay
void delay(unsigned int mseconds)
{
clock_t goal = mseconds + clock... |
C | #include <stdbool.h>
#include <stdio.h>
#define NREGS 16
#define STACK_SIZE 1024
#define SP 13
#define LR 14
#define PC 15
int add(int a, int b);
struct arm_state {
unsigned int regs[NREGS];
unsigned int cpsr;
unsigned char stack[STACK_SIZE];
};
void init_arm_state(struct arm_state *as, unsigned int *f... |
C | /*
* Copyright (c) 2009-2015 Michael P. Touloumtzis.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modif... |
C | #include <stdio.h>
#include <cs50.h>
#include <string.h>
#include <ctype.h>
int main(int argc, string argv[]){
// if no command line args passed
if (argc == 1){
printf("No command line arguments passed\n");
return 1;
}
if (argc > 2){
printf("Too many command line arguments pas... |
C | //---------------------------------------------------------------------------------------
// Smile Programming Language Interpreter (Unit Tests)
// Copyright 2004-2019 Sean Werkema
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the Licen... |
C | #include <stdio.h>
#include "stack.h"
#include "List.h"
//#include "stack.c"
//#include "List.c"
#include <string.h>
int main(int* argc, char* argv[]){
void pass_through(char s[], int size);
int check_op(char*s, int size, int idx); //checks if character from idx till next space is encountered is a number
int return... |
C | #include "rc.h"
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <math.h>
#include <float.h>
void read_objs(OBJ_T **list){
double x,y,z,rad,r,g,b;
*list=NULL;
OBJ_T *obj;
while(scanf("%lf%lf%lf%lf%lf%lf%lf",&x,&y,&z,&rad,&r,&g,&b)==7){
//printf("scanned in:\n%lf %lf %lf\n%lf\n%lf %lf... |
C | #include <stdio.h>
int main()
{
int a,b,i,j;
int num[100];
printf("Enter a number you want the loop of: ");
scanf("%d", &a);
for (i = 0; i < a; i++)
{
printf("Enter a number: ");
scanf("%d", &num[i]);
}
for (i = 0; i <= a; i++)
{
for (j... |
C | #include <stdio.h>
#include <stdlib.h>
#include <locale.h>
#include <string.h>
/*Cabealho
Instituio: Faculdade dos Guararapes
Professor: Guibson Santana
Aluno: ngelo Gonalo da Silva
Turma: CCO 2-MA PIE
Data de Entrega: 22/08/2018
Data de Resoluo: 05/09/2018
Criar um algoritmo em C que receba um Estado brasileiro por
... |
C | //***************************************************
/** ファイルの開き方・閉じ方【fopenとfcloseの使い方】
* https://monozukuri-c.com/langc-file-open-close/
* 11/26
*/
//***************************************************
// #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main(void)
{
//FILE構造体をポインタ変数で用意
FILE *fp1 = ... |
C | #include <stdio.h>
#include <stdlib.h>
#define TElemType int
typedef struct BiTNode{
TElemType data;//数据域
struct BiTNode *lchild,*rchild;//左右孩子指针
}BiTNode,*BiTree;
void CreateBiTree(BiTree *T){
*T=(BiTNode*)malloc(sizeof(BiTNode));
(*T)->data=1;
(*T)->lchild=(BiTNode*)malloc(sizeof(BiTNode));
(*... |
C | #include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <limits.h>
#include <ctype.h>
#include <dirent.h>
// For colors
#define KNRM "\x1B[0m"
#define KRED "\x1B[31m"
#define KGRN "\x... |
C | #include<stdio.h>
int main()
{
float a=62.15269;
printf("\"Hello world\"");// Escape sequence
printf("\ngitam\'s college");
printf("\n %.2f",a);
}
|
C | #if 0
William Daniel Taylor
2/26/18
#endif
#include <stdio.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
int main(int argc, char *argv[]) {
char *address;
address = argv[1];
//socket
int clientSocket;
clientSocket = sock... |
C | #include <stdio.h>
int main()
{
int p;
scanf("%d", &p);
if (p >= 90)
{
printf("AA\n");
}
else if (p >= 80 && p <= 89)
{
printf("A\n");
}
else if (p >= 70 && p <= 79)
{
printf("B\n");
}
else if (p >= 60 && p <= 69)
{
printf("C\n");... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define TAM_LINHA 100
#define TAM_ELEMENTO 30
#define TAM_NOME 100
#define TAM_GENERO 30
#define TAM_TABELA_HASH 29000
/// ********************************************************************
/// Informaes da Tabela Hash;
///... |
C | #include <stdio.h>
#include <string.h>
void main(void)
{
char string[]= "3 lions, 5 elephants 4 deer";
char*find = "0123456789";
int index;
index = strcspn(string, find);
printf("We fond number on %d\n",index);
}
|
C | #include "funcoes.h"
int main(int argc, char** argv)
{
int n,e,r;
char cmd[COMMAND+1], *info; /*cmd e a variavel que guarda os
comandos(so pode ter 11 no maximo)*/
queue_ptr user_vec;
scanf("%d", &n);
user_vec = (queue_ptr) calloc( n,sizeof(struct queue));
scanf("%s", cmd);
while(strcmp(cmd,"quit")!=0)
... |
C | /*LINTLIBRARY*/
#include "port.h"
#ifdef LACK_SYS5
/*
* memcpy - copy bytes
*/
VOIDSTAR
memcpy(dst, src, size)
VOIDSTAR dst;
CONST VOIDSTAR src;
SIZET size;
{
register char *d;
register CONST char *s;
register SIZET n;
if (size <= 0)
return dst;
s = src;
d = dst;
if (s <= d && s + (size-1) >= d) {
/* Ov... |
C | /* Write a C Program to input a number and find all the factors of a number ? */
#include<stdio.h>
void main()
{
int n,i;
printf("Enter the value : \n");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
if(n%i==0)
printf("%d ",i);
}
}
|
C | //
// Created L1MeN9Yu on 2017/11/24.
//
#include <sys/errno.h>
#include <sys/stat.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "gtr_file_utilty.h"
off_t gtr_get_file_size(const char *file_path) {
struct stat st;
if (stat(file_path, &st) == 0) {
return st.st_size;
}
... |
C | #ifndef VECTOR_GUARD
#define VECTOR_GUARD
#include<stdlib.h>
#include<assert.h>
typedef struct{
unsigned int size;
int *data;
unsigned int count;
}vector;
//Function Prototypes
void __vector_resize(vector* info);
vector vector_init();
void vector_push(vector* info,int data);
int vector_po... |
C | #pragma once
struct Index
{
int id;
int address;
int isExist;
};
struct Team
{
int id;
char name[16];
int wins;
long firstPlayerAddress;
int playerNum;
};
struct Player
{
int teamId;
int id;
char surname[16];
char role[16];
int isExist;
long thisAddress;
long nextPlayerAddres... |
C | #include<stdio.h>
int main() /*Program ProgV*/
{
/*DECLARCATION_BLOCK*/
int integer, i;
/*CODE_BLOCK*/
scanf("%i", &integer);
if(integer <= 5 || integer >= 12)
{
printf("%i", integer);
}
printf("%f", 35.000000);
printf("\n");
/*for control vars*/
registe... |
C | /*Enter number of rows : 3
3 2 1 2 3
2 1 2
1 */
#include<stdio.h>
#include<conio.h>
int main()
{
int r;
char c;
printf("Enter start aplabet :");
scanf("%[^\n]c",&c);
printf("\nEnter number of rows :\t");
scanf("%d",&r);
printf("\n... |
C | //
// Created by Bourne on 29/03/2018.
//
#include <stdio.h>
void output(int i, int j) {
printf("i= %d, j = %d\n", i, j);
}
int main(int argc, char* argv[]) {
int a[3] = {0, 1, 2};
printf("%d\n", sizeof(a)); // 数组大小
printf("%d\n", sizeof(&a)); // 指针大小
printf("%d\n", *(a + 1)); // 输出第二个元素... |
C | #include<stdio.h>
#include<conio.h>
struct stack
{
float data[10];
int top;
}s;
void push(float x)
{
s.data[++s.top]=x;
}
int pop()
{
return(s.data[s.top--]);
}
float fix(char symbol, float op1, float op2)
{
switch(symbol)
{
case '+':return(op1 + op2);
case '-':return(op1 - op2);
cas... |
C | #include "uart.h"
int putchar(char c)
{
uart_putchar(c);
return 0;
}
char getchar(void)
{
return uart_getchar();
}
int puts(const char * s)
{
while (*s)
{
if (*s == '\n')
uart_putchar('\r');
uart_putchar(*s);
s++;
}
return 0;
}
char *gets(char * s)
{
char * buf = s;
char c;
while (1)
... |
C | #include "malloc.h"
int set_tinyheader(t_list *lst)
{
int i;
i = 1;
lst->content[0] = TRUE;
while(i < 127)
{
lst->content[i] = FALSE;
i++;
}
return(1);
}
void *first_tiny(size_t size)
{
void *str;
int f;
str = mmap(0, PSIZE * 2, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIV... |
C | #include <stdio.h>
#include <windows.h>
#include <dirent.h>
#include <stdbool.h>
#include "saisie.h"
#include "affichage.h"
#include "sudoku.h"
#define COLONNE 47
#define LIGNE 75
///Commande d'affichage basique
void ligne(void){
for(int i=0;i<COLONNE;i++){
printf("=");
}
printf(... |
C | #include<stdio.h>
int main()
{
struct student
{
int rollno;
char name[80];
char sec;
};
struct student s1;
printf("\n enter the rollnumber");
scanf("%d",&s1.rollno");
printf("\n enter the name");
scanf("%s",&s1.name);
printf("\n enter the sec");
scanf("%s",&s1.sec);
printf("\n ******student details******");
printf("\n ... |
C | ElementType Find( List L, int m )
{
PtrToNode mthNode=NULL, node;
//因为L带头结点,所以node为L的next,否则为L
node =L->Next;
//遍历链表
while(node)
{
//将计数器减一
--m;
//如果当前计数器为0,表示正好访问过m个结点,那么第一个结点就是当前的倒数第m个结点
if(m==0)
mthNode = L->Next;
//如果计数器为负,则表示要把倒数第m个结点往后挪一个... |
C | #include <stdlib.h>
#include <stdio.h>
#include "print.h"
#include "parser.h"
#include "eval.h"
static cell_t* call_dispatch(mem_t* mem, cell_t* callable, cell_t* args);
static cell_t* call_lambda(mem_t* mem, cell_t* arg_names, cell_t* arg_vals, cell_t* body);
static cell_t* call_macro(mem_t* mem, cell_t* arg_names,... |
C | #include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <string.h>
void main() {
int i;
pid_t pid;
char input[100];
fprintf(stderr, "richegg-shell $ ");
while(scanf("%s", input)) {
if (strcmp(input, "exit") == 0) {
exit(0);... |
C | #include "thread.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*
* Variables
*/
// There are total of 2048 pages
const int NUM_PAGES;
int currentThreadId = 1;
/*
* Implementations
*/
Thread *createThread() {
Thread *ret = malloc(sizeof(Thread));
bzero(ret, sizeof(Thread));
ret->threadId... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* paralel_path.c :+: :+: :+: ... |
C | #include <stdio.h>
int main() {
int arr[100], n;
do {
printf("Enter number of elements: ");
scanf("%d", &n);
if (n > 100)
printf("Please enter a size within 100 elements.\n");
} while (n > 100);
printf("\nEnter elements:\n");
for (int i=0; i<n; i++)
sc... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char **argv) {
char *data;
int magic;
sscanf(argv[1], "%s", data);
sscanf(argv[2], "%d", &magic);
if (magic == 0x31337987) {
puts("Found VERY specific magic number");
}
if (magic < 100 && magic % 15 == 2 && magic % 11 ==... |
C | #pragma once
#include <pthread.h>
//#include <sched.h>
//#include <semaphore.h>
typedef int counter_t;
/*Sets val to 0 and initializes the mutex.*/
void init_counter(counter_t *counter);
/*Increments val by one.*/
void increment_counter(counter_t *counter);
/*Decrements val by one*/
void decrement_counter(counter_t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.