language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include <stdio.h> #include <sys/socket.h> #include <netinet/in.h> #include <string.h> #include <stdlib.h> #include<math.h> #include<errno.h> #include<signal.h> #define SERV_PORT 5051 void sig_chld(int signo) { pid_t pid; int stat; while ( (pid = waitpid(-1, &stat, WNOHANG)) > 0) printf("child %d terminated\n", pid); ...
C
//Sat Feb 27 10:16:59 UTC 2021 //Write a program to convert decimal to binary //ll #include <stdio.h> #include <stdlib.h> #include <math.h> typedef struct { char *stack_item; //pointer to array of stack values for dynamic allocation by malloc int top; int size; }Stack; void printBinary(unsigned int n); v...
C
/* * File: Main.c * Author: Armstrong Subero * PIC: 18F4553 w/Ext OSC @ 16MHz ; PLL to 48MHz, 5v * Program: 00_Blink * Compiler: XC8 (v1.38, MPLAX X v5.05) * Program Version: 1.0 * * * Program Description: This Program Allows PIC18F4553 to blink an LED at * ...
C
#include "../inc/getstring.h" uchar* get_string(uint16_t *len) { *len=0; uint16_t capacity=1; uchar* s=(uchar*)malloc(10*sizeof(uchar)); uchar c=getchar(); while(c!='\n') { s[(*len)++]=c; if(*len>=10) { capacity*=2; s=(uchar*)realloc(s, capacity*sizeof(uchar)); } c=getchar(); } s[*len]='\0'; ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "util.h" #include "abb.h" #include "avl.h" #define LIMITE 3 int min(int a, int b) { return (a < b ? a : b); } int min3(int a, int b, int c) { return min(a, min(b, c)); } void listarPalavras (No *raizArvore, char *palavra) { if (raizArvore ...
C
#include <fcntl.h> #include <unistd.h> #include<sys/stat.h> #include<semaphore.h> #include<stdlib.h> #include <string.h> #include<stdio.h> int main(int argc, char const *argv[]) { char * semname1 = "/SemFile"; char * semname2 = "/SemFile1"; char * fileName = "abc.txt"; sem_t *s1 ,*s2; pid_t p ; ...
C
/* Write a function to multiply all the numbers in a list. */ #include <stdio.h> /* Multiply the elements of a list*/ int multiply(int *list, int elements); int main() { /*--------------------------------------------------- Put the numbers you want to multiply inside the {} ------------------------------------------...
C
/* ************************************************************************ * file: listrent.c Part of CircleMUD * * Usage: list player rent files * * Written by Jeremy Elson * * All Rights Reser...
C
/* ** EPITECH PROJECT, 2021 ** main ** File description: ** main sokoban */ #include "my.h" int move_player(int *x, int *y, int result) { switch (result) { case 66: *y += 1; break; case 65: *y -= 1; break; case 67: *x += 1; break; case 68: ...
C
//2 tipologie di thread: cons, prod. //5 istanze che fanno codice prod, 1 cons //compito 7.7.11 #include "header.h" #include <stdio.h> #include <stdlib.h> #include <unistd.h> #define NUM_PRODUTTORI 5 #define NUM_CONSUMATORI 1 #define TOTAL NUM_PRODUTTORI+NUM_CONSUMATORI #define DIM 5 #define NUM_PROD 4 #define NU...
C
#include <stdio.h> int main(){ printf("2. Find the sum of the even-valued terms (under 4.000.000) \ of the Fibonacci sequence.\n"); int u1, u2, u3, count=0; u1=u2=1; do{ u3 = u1+u2; u1 = u2; u2 = u3; if(!(u3 % 2)) count+=u3; } while(u3<4000000); printf("Sum = %d\n", count); return 0; }
C
/* Desenvolva um programa em C que leia 99 números do tipo inteiro do usuário. Separe esses números em pares e ímpares e os armazenem em dois outros vetores chamados vet_par e vet_impar. Em seguida, o programa dever apresentar os resultados na tela. */ #include <stdio.h> #define TAM_VET 99 int main() { printf("\t...
C
// toolfunc.c, 159 #include "spede.h" #include "typedef.h" #include "extern.h" void MyBzero(char *p, int byte_size) { int i; for(i=0; i<byte_size; i++){ *p=0; p++; } } void EnQ(int pid, q_t *p) { if(p->len == Q_LEN){ cons_printf("Queue is full.\n"); return; } p->len++; p->q[p->tail] = pid; p->tail...
C
/*====================================================================* * * void syslogd_close_sockets (struct socket *sockets); * * close open sockets; this stops incoming messages from external * sources but syslogd can still post outgoing messages until all * syslogs are closed; * * visit sockets ...
C
#include "pomocnicze2.h" #include "pomocnicze3.h" void readName(char *ch, Customer *current, FILE *dataBase) { int i = 0; while(*ch != '#'){ current -> name[i] = *ch; *ch = getc(dataBase); i++; } } void readSurname(char *ch, Customer *current, FILE *dataBase) { int i = 0; ...
C
//Ŷ //1.жരڷKṩй˿ͰʱŶӣдڿʱһλ˿ͼȥôڴ //жരڷģж typedef struct People ElementType; struct People{ //˿ int T; //˿͵ʱ int P; //˿ﱻʱ }; typedef int Position; struct QNode{ //н ElementType *Data; //˿ Position Front, Rear; //еͷβָ int MaxSize; // }; typedef struct QNode *Queue; Queue CreateQueue(int MaxSize){ Queue Q ...
C
#include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <netinet/tcp.h> #include <arpa/inet.h> #include <unistd.h> #include <strings.h> #include <string.h> #include <errno.h> #include <time.h> #include <fcntl.h> #include <linux/sockios.h> #include "session....
C
/* * Banker's Algorithm for SOFE 3950U / CSCI 3020U: Operating Systems * * Copyright (C) 2015, Muhammad Ahmad, Timothy MacDougall, Devin Westbye * All rights reserved. * */ #include <stdlib.h> #include <stdio.h> #include <stdbool.h> #include <pthread.h> #include <semaphore.h> #include "banker.h" // Put any othe...
C
#include <stdio.h> int i, n, f, a, b; int main() { scanf("%d", &n); if (n<3) { f=1; } else { a=1; b=1; } for (i=3; i<=n; i++) { f=a+b; a=b; b=f; } printf("%d", f); }
C
#include <stdio.h> #include <stdint.h> #include <string.h> #include <time.h> #include <math.h> #define TEXT_LENGTH 1000000 double run_naive_implementation(){ printf(" ----------TEST 1-------------- \n"); // Time measurements according to: // https://www.tutorialspoint.com/how-to-measure-time-taken-by-a-...
C
/* The structure of the tree is struct tree_node { int data; struct tree_node* left_child; struct tree_node* right_child; }; */ struct tree_node* insert(struct tree_node* root, int key) { if (root == NULL) { struct tree_node *temp = (struct tree_node *)malloc(sizeof(struct tree_node)); temp->data =...
C
#define DIM_TABLOU 10 #define LUNGIME_N 5 #define LUNGIME_PP 3 #define LUNGIME_NPP 4 #define LUNGIME_NN 3 static int numarPrim(int numar) { int i; int ret = 0; if(numar < 2) ret = 0; if(numar == 2) ret = 1; for(i = 2; i <=( numar / 2); i++) if((numar % i) == 0) ...
C
// Compile this assignment with: gcc main.c -o main // // Include parts of the C Standard Library // These have been written by some other really // smart engineers. #include <stdio.h> // For IO operations #include <stdlib.h> // for malloc// Our library that we have written. // Also, by a really smart engineer! #inclu...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> struct etudiant{ char nom[100]; char prenom [100]; unsigned int age; unsigned int annee; }; typedef struct etudiant etudiant; void lire_ligne(char * ch){ int i = 0; char c; c = getchar(); while(c != '\n'){ ch[i] = c; ...
C
#include <stdio.h> #include <string.h> #include <sys/types.h> #include <sys/stat.h> #include <time.h> #define MAX_SPECIAL_CHARS 20 struct pair { int val1; char val2; }; #define TITLELEN 1024 static char title[TITLELEN]; static char exp_title[TITLELEN]; #define MAX_LINE_LEN 4096 static char line[MAX_LINE_LEN]; ...
C
/** * IFJ20 Compiler * @file postfix.c * @authors Martin Bednář (xbedna77) */ #include <stdlib.h> #include <stdbool.h> #include "postfix.h" #include "vargen.h" #include "utils.h" #include "../error.h" #include "../memory.h" typedef struct tstack_t { int length; token_t** memory; } tstack_t; tstack_t* tstac...
C
// // BEEPoo - Standalone AY-3-8912 player with ATMEGA32U4 with Arduino bootloader // // Copyright (c) 2014 SmallRoomLabs / Mats Engstrom - mats.engstrom@gmail.com // // Hardware and Firmware released under the MIT License (MIT) than can be // found in full in the file named LICENCE in the git repository. // // https:...
C
#include<stdio.h> int main() { int arr[5]; arr[0] = 10; arr[1] = 20; arr[2] = 30; arr[3] = 40; arr[4] = 50; int arr2[] = { 10,20,30,40,50 }; int arr3[5] = {10,20,30,40,50 }; printf("%d\n",&arr[0]); printf("%d\n",&arr[1]); printf("%d\n",&arr[2]); printf("%d...
C
/* wq@ function (W check) U expression ھ expression XT "True" "False" */ #include <stdio.h> ??? check(???) { ??? } int main(void) { int x = 5; int y = 3; check(x > 2 && y == 3); check( !(x < 2 || y == 3) ); check(x != 0 && y); check(x == 0 || !y); check(x...
C
#include <stdio.h> int main() { float valor= 900.25; int tamanho; tamanho = sizeof(valor); printf("Um float : %f\n",valor); printf("espaco de memoria ocupado: %d bytes\n", tamanho); return 0; }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* print_err.c :+: :+: :+: ...
C
/* Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have exactly one solution. For example, given array S = {-1 2 1 -4}, and target = 1. The sum that is closest to the target is 2...
C
#include <stdio.h> #include <stdlib.h> #include <conio.h> #include <windows.h> char M[3][3]={{' ',' ',' '},{' ',' ',' '},{' ',' ',' '}},id_1[100],id_2[100]; int tour=1,score_id_1=0,score_id_2=0; int GameLoop(){ clrscr(); printf("Morpion Tour : %d | Score: %s : %d /!/ %s : %d \n",tour, id_1,score_id_1,id_2,score_id_2...
C
/* ** token_funct.c for token_funct.h in /home/ozouf_h//42sh/include ** ** Made by harold ozouf ** Login <ozouf_h@epitech.net> ** ** Started on Mon Apr 9 15:44:05 2012 harold ozouf ** Last update Fri May 18 22:26:05 2012 kevin platel */ #include <stdlib.h> #include "token.h" #include "token_funct.h" t_bool is_a...
C
#pragma once #include<dirent.h> #include<sys/stat.h> #include<sys/types.h> //struct dirent //{ // long d_ino; /* inode number 索引节点号 */ // off_t d_off; /* offset to this dirent 在目录文件中的偏移 */ // unsigned short d_reclen; /* length of this d_name 文件名长 */ // unsigned char d_type; /* the type of d_name 文件类型 */ // char d_na...
C
/* ** my_put_nbr.c for putnbr in /home/sauvau_m/rendu/Piscine_C_J07/lib/my ** ** Made by Mathieu Sauvau ** Login <sauvau_m@epitech.net> ** ** Started on Tue Oct 6 17:44:34 2015 Mathieu Sauvau ** Last update Mon Feb 1 21:16:23 2016 Mathieu Sauvau */ #include "function.h" int my_put_nbr(int nb) { int div; i...
C
#include<stdio.h> int main() { char x = 15; char y = 10; int *ptr = NULL; ptr = (int *)&x; *ptr = 50; printf("%d\n",*ptr); return 0; }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* main.c :+: :+: :+: ...
C
#include <pthread.h> #include <stdio.h> #include <unistd.h> #include <stdlib.h> #define MAX_THREAD_NUM 100 pthread_mutex_t m_lock = PTHREAD_MUTEX_INITIALIZER; int total = 0; void *factorial(void *param){ int *n = (int*)param; int n_fac = 1; for(int i = *n; i > 0; i--) n_fac *= i; printf("n = %d : %d! = %d\n"...
C
#include <stdio.h> int main() { //printf("Tutorijal 4, Zadatak 2"); int i,j,a,b; printf("Unesite stranice pravougaonika a,b: "); scanf("%d,%d",&a,&b); for(i=1;i<=b;i++){ if(i==1 || i==b){ for(j=1;j<=a;j++){ { if(j==1 || j==a){ printf("+"); } else printf("-"); } } } e...
C
#include<stdio.h> #include<math.h> int main() { int a, r; float result; printf_s("Enter a and r:\n"); scanf_s("%d %d", &a, &r); result = a * sqrt(4 * pow(r, 2) - pow(a, 2)) + pow(r, 2)*(3.1415926535 - 4 * asin(sqrt(1 - (pow(a, 2) / (4 * pow(r, 2)))))); printf_s("%.3f\n", result); system("pause"); return 0; }
C
#include <stdio.h> #include <stdlib.h> #include <errno.h> #include <unistd.h> #include <fcntl.h> #include <string.h> #include <math.h> #include <sys/wait.h> #include <ctype.h> #define ARTICLE "classique" #define SERVEUR "sw1" #define ACHETEUR "Philippe" #define TRANSPORTEUR "Xavier" #define QteRouleauStock 100 #define...
C
/****************************************************************************************** Функции работы с сокетами Copyright (с) Stanislav V. Tretyakov, svtrostov@yandex.ru ******************************************************************************************/ #include "sys_socket.h" /*------------------------...
C
/* * main.c * * Created on: Aug 31, 2021 * Author: shrouk */ #include "stdio.h" void main () { int n1,i; float average=0,sum=0; printf("Enter the numbers of data:"); fflush(stdout); fflush(stdin); scanf("%d",&n1); float arr[n1]; for(i=0;i<n1;i++){ printf("%d.Enter number:",++i); --i; fflush(stdo...
C
#include <stdio.h> #include <stdlib.h> int x[] = {1,2,3,-1,-2,0,184,340057058}; int y[] = {0,0,0,0,0,0,0,0}; int f(int a) { int i = 0; while(a != 0) { if ((a & 0x80000000) != 0) i++; a = a << 1; } return i; } int main (int argc, char* argv[]) { for (int i = 7; i>=0; i--){ y[i] = f(x[i]); ...
C
/* * File: usart.c * Author: YH31 * * Created on May 8, 2020, 9:26 AM */ #include "usart.h" #include "lcd.h" void UsartInit() { // 1.SPBRGò // //貨ΪK,SPBRGֵΪx //TXSTA<2>ֵΪ1 //ôͬ첽ʹùʽ£ //x=Fosc/(K*16)-1 //TXSTA<2>ֵΪ0 //ͬģʽ£x=Fosc/(K*4)-1 //첽ģʽ£x=Fosc/(K*64)-1 //ǰK=2000...
C
#include <stdio.h> /*6. Tipos estruturados. Exercício 6.2 */ //Define a estrutura de vetor typedef struct vetor{ float x, y, z; } Vetor; /*Função que retorna o produto de dois vetores */ float dot ( Vetor* v1, Vetor* v2 ) { float prod; prod = ( v1->x * v2->x ) + ( v1->y * v2->y ) + ( v1->z * v2->z ); ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* get_next_line.c :+: :+: :+: ...
C
/*6 length of a string using pointers*/ #include <stdio.h> int main() { char str1[50],*p; printf("\nEnter a string: "); scanf("%s",str1); p=str1; int count=0; while (*p !='\0') { count++; p++; } printf("the length of the string is %d",count); }
C
// Evan Smedley 101148695 // Trong Nguyen 100848232 #include <sys/shm.h> #include <stdlib.h> #include <stdio.h> // Create shared memory int shm_create(key_t key, int size) { int shmid = shmget(key, size, IPC_CREAT | 0666); if (shmid == -1) { fprintf(stderr, "shmget failed\n"); exit(EXIT_FAILUR...
C
#include<math.h> #include<stdio.h> int main(){ prime_test_sqrt(99999991); // prime_test_half(99999991); } //------------------------------------------- prime_test_half(int num){ printf("Half Trick Function \n"); int tnum=0; tnum = num / 2; int count = 0; for(int i=1; i <= tnum; i++){ ...
C
#define _CRT_SECURE_NO_WARNINGS 1 #include<stdio.h> #include<stdlib.h> int main() { int sn = 0; int a = 2; sn = a * 5 + a * 4 * 10 + a * 3 * 100 + a * 2 * 1000 + a * 10000; printf("%d", sn); system("pause"); return 0; }
C
#include<stdio.h> int stack[20]; int top=-1; void push(char data){ top++; stack[top]=data; } void pop(){ if(top==-1){ printf("Nothing to be removed"); } else top--; } int empty(){ if(top==-1) return 1; //1-> stack empty else return 0; //0-> stack is not empt...
C
/*************************************************************************** VCS-80 12/05/2009 Skeleton driver. http://hc-ddr.hucki.net/entwicklungssysteme.htm#VCS_80_von_Eckhard_Schiller This system is heavily based on the tk80. The display and keyboard matrix are very similar, while the opera...
C
//test code from // https://www.geeksforgeeks.org/multithreading-c-2/ /*compile gcc -Wall thrvar.c -o thrvar -l pthread test code from https://www.geeksforgeeks.org/multithreading-c-2/ */ #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <pthread.h> // Let us create a global variable to ch...
C
#include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <inttypes.h> enum { STRUCT_SIZE = 12, BUF_SIZE = 3 }; int dfs(int fd, int idx) { off_t offset = idx * STRUCT_SIZE; if (lseek(fd, offset, SEEK_SET) == -1) { fprintf(stderr, "Invalid ...
C
int reverse(int x) { int temp = x; int sol = 0; for (; temp != 0; ) { sol = sol * 10 + temp % 10; temp = temp / 10; } }
C
#include <stdlib.h> #include <string.h> #include <stdio.h> #include "document_create.h" document_create_t *document_create_create( long dispatchJobId, char *notes, char *documentTypeUuid, list_t *fields ) { document_create_t *document_create = malloc(sizeof(document_create_t)); document_create-...
C
#include <petscsys.h> /*I "petscsys.h" I*/ /*@C PetscGatherNumberOfMessages - Computes the number of messages a node expects to receive Collective Input Parameters: + comm - Communicator . iflags - an array of integers of length sizeof(comm). A '1' in ilengths[i] represent a mess...
C
#include <stdio.h> #define MAX_EXPRESSION 100 int isParenthesisBalanced(char *); int main() { char expr[MAX_EXPRESSION]; printf("Enter expression: "); scanf("%s", &expr); if(isParenthesisBalanced(expr) == 0) printf("Balanced parenthesis. \n"); else printf("Unbalanced\n"); r...
C
#include <limits.h> #include <stdbool.h> #include <stdio.h> #include<stdlib.h> typedef struct graph{ int **mat; int nodes; }graph; graph *createGraph(int N) { int i; graph *new = malloc(sizeof(graph)); new->nodes = N; new->mat = malloc((N + 1) * sizeof(int*)); for(i = 1; i <= N; i...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> typedef struct _Endereco Endereco; struct _Endereco { char logradouro[72]; char bairro[72]; char cidade[72]; char uf[72]; char sigla[2]; char cep[8]; char lixo[2]; }; int compara(const void *e1, const void *e2) {...
C
#include<stdio.h> void merge(int a[], int p, int q, int r){ int n1 = q-p+1; int n2 = r-q; int l1[n1],l2[n2]; for(int i=0; i<n1; i++) l1[i]=a[p+i]; for(int i=0; i<n2; i++) l2[i]=a[q+i+1]; int i=0,j=0,k=p; while(i<n1 && j<n2){ if(l1[i]<=l2[j]){ a[k] = l1[i]; i++; } else{ a[k] = l2[j]; j++; ...
C
#include "reef.h" #include "_mdf.h" #define _FORCE_HASH_AT 10 void _mdf_drop_child_node(MDF *pnode, MDF *cnode) { if (cnode->parent != pnode) return; MDF *prev = cnode->prev, *next = cnode->next; if (prev == NULL) { pnode->child = next; if (next) next->prev = NULL; else pnode->l...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #include "bstr.h" int main(int argc, char *argv[]) { unsigned long p = 0xAA0000AA; char q = 0x10; char r = 'a'; char buf[0x1000]; char *pre1, *pre2, *pre3, *pre4; int cpos; /*Test 1:convert other type variable to bitstring*/ printf( "/*Test 1:conve...
C
#include<stdio.h> /* int main() { int i = 0 , j = 0, num = 0 ; char arr[]="Piyush" ; char *ptr = NULL ; //printf("%s\n",arr); while(arr[i]!='\0') { for(j=0 ; j<=i ; j++) { printf("%c ",arr[j]); } i++ ; printf("\n"); } return 0 ; } */ ////////////////////////////////////////////////////////...
C
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<sys/types.h> #include<sys/ipc.h> #include<sys/msg.h> int main(void) { key_t key; int proj_id = 1; int msqid; char message1[] = {"hello microsoft"}; char message2[] = {"goodbye"}; struct msgbuf /* you need to define your own msgbufs */ { long m...
C
#include "standard.h" int main(int argc, char **argv) { int opt; int num_levels = DEFAULT_NUM_LEVELS; int num_children = DEFAULT_NUM_CHILDREN; int s; bool pflag = false; bool sflag = false; opt = getopt(argc, argv, OPT_STRING); while (opt != -1) { switch (opt) { ca...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <rtthread.h> #include "webclient.h" #define WEBCLIENT_READ_BUFFER (1024 * 4) int webclient_test(int argc, char **argv) { struct webclient_session* session = RT_NULL; unsigned char *buffer = RT_NULL; int ret = 0; if(argc != 2) {...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> /* ax^2 + bx + c entradas: 2 4 -1 2 9 5 */ int main() { float a, b, c, x1, x2, delta; printf("Digite o valor de a: "); scanf("%f", &a); printf("Digite o valor de b: "); scanf("%f", &b); printf("Digite o valor de c: "); scanf("%f",...
C
#ifndef _TYPES_H_ #define _TYPES_H_ /* ڹܽ ѯ*/ typedef uint8_t PinName; /* InPut and OutPut mode */ typedef enum Mode { In=0, Out }Mode; /* used as OutPut Pins Low or High */ typedef enum Station { Low=0, High, Tristate }Station; #endif
C
#include <stdio.h> #include <stdlib.h> struct Node { int data; struct Node *next; }; void display(struct Node *ptr) { int size = 0; while (ptr != NULL) { printf("%d\t", ptr->data); ptr = ptr->next; size++; } printf("size=%d", size); } struct ...
C
#include <stdio.h> #include <time.h> int main() { int x, fatorial, i; printf("Digite o valor do x:(entre 0 e 12) \n"); scanf("%d",&x); fatorial = x; if (x==0) { fatorial = 1; printf("%d",fatorial); } else { for (i = x-1; i != 1; i--) fatorial = fatorial * i; ...
C
#define _GNU_SOURCE // Obtain O_DIRECT definition from <fcntl.h> #include <fcntl.h> // #include <malloc.h> #include "../tlpi.h" int main(int argc, char *argv[]) { int fd; ssize_t nread; size_t length, alignment; off_t offset; char *buffer; if (argc < 3 || strcmp(argv[1], "--hlep") == 0) { usage_error("%s file...
C
#include <stdio.h> #include <string.h> #include <smi.h> int main(int argc, char *argv[]) { SmiNode *smiNode; int oidlen, first = 1; if (argc != 2) { fprintf(stderr, "Usage: smisubtree oid\n"); exit(1); } smiInit(NULL); for((smiNode = smiGetNode(NULL, argv[1])) && ...
C
/* * blevel.c * * Created by Alejandro Santiago on 12/09/20. * aurelio.santiago@uat.edu.mx * */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include "types.h" double *calcula_blevel() { int i,nodo; double *blevel; blevel=reserva_vector_double(T); nodo=0; //el nodo de entra...
C
#include "image.h" #include "ppmIO.h" #include <stdlib.h> #include <stdio.h> #include <math.h> /* * Allocates an Image structure and initializes * the top level fields to appropriate values. Allocates space for an image of the specified size, unless * either rows or cols is 0. Returns a pointer to the allocat...
C
#include <stdio.h> struct human; struct human { int id; char name[64]; //struct human lover; struct human *lover; }; int main() { struct human stlk = {1,"sinzzang",NULL}; struct human naru = {2,"narci", &naru}; struct human *lover1; struct human *lover2; char* l2name; stlk.lover = &naru; lover1 = stlk.love...
C
#include <stdio.h> int main(void) { char char_A = 'A'; char char_B = 'B'; const char * myPtr1 = &char_A; char * const myPtr2 = &char_A; const char * const myPtr3 = &char_A; *myPtr1 = char_B; // not allowed myPtr2 = &char_B; // not allowed return 0; }
C
#include "lexer.h" #include "parserDef.h" #include "symbolTable.h" #include <stdlib.h> int ht_size=91; int last_offset=0; matSize getOffset(astNode s,matSize m){ astNode temp=s,tempChil; int a=0,row,prev; while(temp!=NULL){ tempChil=temp->children; row=0; while(tempChil!=NULL){ ...
C
#include<stdio.h> #include<stdlib.h> #include<unistd.h> #include<sys/select.h> #include<string.h> int main(){ fd_set readfds, writefds; char msg[100]; int activity, max; FILE *fdw = popen("./reader", "w"), *fdr1 = popen("./writer1", "r"), *fdr2 = popen("./writer2", "r"), *fdr3 = popen("./writer3", "r"); in...
C
#include <poll.h> #include <termios.h> void _shrink(int alink, char *result, int x) { *result=x; } void _extend(int alink, int *result, char x) { *result=x; } void _strlen(int alink, int* result, char *s) { char *t=s; for (;*s;s++) {} *result=(int)(s-t); } void _strcmp(int alink, int *result, char *s2, ch...
C
/* -*- coding: iso-latin-1-unix; -*- */ /* DECLARO QUE SOU O UNICO AUTOR E RESPONSAVEL POR ESTE PROGRAMA. // TODAS AS PARTES DO PROGRAMA, EXCETO AS QUE FORAM FORNECIDAS // PELO PROFESSOR OU COPIADAS DO LIVRO OU DAS BIBLIOTECAS DE // SEDGEWICK OU ROBERTS, FORAM DESENVOLVIDAS POR MIM. DECLARO // TAMBEM QUE SOU RESPONSAV...
C
#include<stdio.h> #include<unistd.h> #include<sys/types.h> #include<sys/wait.h> #include<stdlib.h> int main(int argc,char *argv[]) { for(int i=1;i<=4 ;i++) { fork(); printf("\n %d : my PID = %d \n ",i,(int)getpid()); } sleep(1); printf("--> my PID = %d \n",(int)getpid()); return 0; }
C
#include <stdio.h> #include <string.h> /**********Begin**********/ char* fun(char *a) { int num = strlen(a); char* p = &a[num-1]; while (*p == '*') { a[num-1] = ' \0'; p--; num--; } return a; } /**********End**********/ int main() { char s[81]; fgets(s,81,stdin); fun( s ); printf("The string after delete...
C
#include "lists.h" /** * insert_dnodeint_at_index - insert a new node at a given position * @h: pointer to the head of the list * @idx: index of where the new node should be inserted, starting from 0 * @n: data of the new node * * Return: pointer to the new node or NULL on failure */ dlistint_t *insert_dnodeint...
C
#include<stdio.h> int main() { int i; for(i=0;i<100;i++) { if(((i%10)%3)==0) { printf("%d \t",i); } } }
C
#include <msp430.h> /** * main.c */ int main(void) { WDTCTL = WDTPW | WDTHOLD; // stop watchdog timer P1DIR &= ~BIT1; //configures as input P9OUT |= BIT7; // pull-up resistor P9REN |= BIT7; //enable resistor on P2.1 P9DIR |= BIT7; //configures as output ...
C
// // // ParameterDatabase.h // #ifndef PARAMETERDATABASE_H #define PARAMETERDATABASE_H #include "../GeneralInclude/ForwardDeclarations.h" #include "../GeneralInclude/BasicTypes.h" #include "../Base/CC_RootObject.h" #include "../Qom/object.h" /* * Base class from which all parameter database classes are derived....
C
#include "myLib.h" #include "furtherTrees.h" #include "trees.h" // TODO 2.0 // TODO 4.0 // Prototypes void initialize(); void game(); // Button Variables unsigned short buttons; unsigned short oldButtons; // Horizontal Offset unsigned short hOff; int main() { initialize(); while(1) ...
C
#include "head.h" #include <string.h> unsigned long long tick(void) { unsigned long long tmp; __asm__ __volatile__ ("rdtsc" : "=A" (tmp) ); return tmp; } int Plus_R(int n, int m, float *A1, float *A2, int *JA1, int *JA2, struct IA *IA1, struct IA *IA2, int lenA1, int lenA2, flo...
C
#include <stdio.h> #include <netdb.h> #include <arpa/inet.h> int main(int argc, char *argv[]){ char *host; host = argv[1]; if (argc < 2){ printf("Modo de uso: ./resolver www.businesscorp.com.br\n"); return 0; } else { struct hostent *alvo = gethostbyname(host); if (alvo == NULL) { printf ("Ocorreu u...
C
/* Tier 3 : Part 5 : Question 3 */ #include<stdio.h> #include<stdlib.h> #include<stdarg.h> int number_input(); int add_some_numbers(); double add(int number_count,...); int number_input()//simple function for getting a number { int user_number; while( scanf("%d",&user_number)!=1) { printf("Pleaes enter an in...
C
/************************************************************************* > File Name: userprogram.c > Author: tiany > Mail: tianye04@qq.com > Description: 先打印出当前进程的pid,使得程序睡眠一段时间,然后根据pid > 挂载内核进程,此时程序睡眠结束,执行chdir()函数切换工作目录,陷入 > 内核,调用挂载的内核模块中的chdir()处理函数,在该自定义函数中写 > 进程地址空间; > chdir()函数返回,...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include "WaveLib.h" #include "../Gnuplot/Gnuplot.h" int comp( const void *a, const void *b ) { if( (*(double*)a - *(double*)b) > 0.00001 ) return 1; else if( (*(double*)a - *(double*)b) < -0.00001 ) return -1; else return 0; } void Wave...
C
/* * --------------------------------- * Ʈ Ž * * --------------------------------- */ #include <stdio.h> #include <malloc.h> #include <string.h> struct tfield { char name[20]; /* ̸ */ char tel[20]; /* ȭȣ */ struct tfield *pointer; /* 带 Ű */ } *head; struct tfie...
C
//Aluno: Anderson Reis dos Santos //Matricula : 03098292 //Turma : CIN04S1 #include <stdio.h> #include <stdlib.h> void sort(int *arr, int size){ int x, y, value; for (x = 1 ; x < size ; x++){ value = arr [x]; for (y = x - 1 ; y >= 0 && arr[y] > value ; y--){ arr[y+1] = arr[y]; } arr...
C
#include "all.h" tagRng_t lastTagRng; int updateTagRng(char *str, char *bgnPtn, char *endPtn, int ignoreCase) // mbs_ { tagRng_t *i = &lastTagRng; char *p = mbs_strstrCase(str, bgnPtn, ignoreCase); if(!p) return 0; i->bgn = p; i->innerBgn = p + strlen(bgnPtn); p = mbs_strstrCase(i->innerBgn, endPtn, ignore...
C
/* CREMENESCU RAUL-VALENTIN 333CB */ #include "utils.h" double* my_solver(int N, double *A, double* B) { int i, j, k; double *D = malloc(N * N * sizeof(double)); double *final = malloc(N * N * sizeof(double)); double *A_tr = malloc(N * N * sizeof(double)); double *B_tr = malloc(N * N * siz...
C
#include <stdio.h> #include <string.h> #include "../wumanber.h" #include "test.c" void test_wumanber_init(void); void test_wumanber_search(void); #define HBITS 4 #define TABLE_SIZE 32768 #define NPAT 2 /* #define NPAT 3 */ uint8_t *patterns[NPAT] = { "jour", "hui", /* "h", */ }; const char *text = "hello, ...