language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include <stdio.h> #include <unistd.h> #include <string.h> #include <stdlib.h> #include <sys/types.h> #include <sys/wait.h> #include <fcntl.h> #include <malloc.h> #define MAX_COM 8 #define MAX_COM_LEN 64 char **_getline(int *com_count, char **args) { int arg = 0; char **com = malloc(MAX_COM * sizeof(char*)...
C
#include <string.h> #include <stdlib.h> #include <stdio.h> #include <err.h> #include "bus.h" void callback(void* _ctx, void* _msg) { int msg = *(int*) _msg; int ctx = *(int*) _ctx; printf("Callback for client %d received: 0x%x\n", ctx, msg); } int main() { Bus* bus; int msg0, msg1, ctx0, ctx1; ctx0 = 0; ctx1...
C
#include <stdio.h> #include <stdlib.h> struct Date { int day; int month; int year; }; struct person { char *name; int age; struct Date *dob; }; void display(struct person** details, int size) { int i; for (i = 0; i < size; i++) { printf("Name = %s\n", details[i] -> name); printf("Age = %d\n...
C
/* Programa de estilo primitivo */ #include <stdio.h> #define MX 1000 int main(void) { void Generar(int, double []); void Alterar(int, double []); void Imprimir(int, double []); int n; double v[MX]; n ++; LeeNComponentes: printf("\n Introduce el numero de componentes: "); scanf("%d", &n); if (...
C
/************************************************************************** AstronomicalAlgorithms A portable ANSI C implementation of some of the algorithms published in Astronomical Algorithms by Jean Meeus 2nd edition (December 1998) Willmann-Bell ISBN: 09433966...
C
/* ============================================================================ Name : three_stacks_one_array_trial.c Author : Version : Copyright : Your copyright notice Description : Hello World in C, Ansi-style ============================================================================ */...
C
#include <assert.h> #include <ctype.h> #include <errno.h> #include <fcntl.h> #include <math.h> #include <netdb.h> #include <netinet/in.h> #include <stdio.h> #include <stdarg.h> #include <stdbool.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include <sys/mman.h> #include <sys/socket.h> #include <sys/st...
C
#include <stdio.h> #include <stdlib.h> typedef struct dummy_Cell { int data; struct dummy_Cell *next; } Cell; int main(){ Cell *c2; c2 = (Cell *)malloc(sizeof(Cell)); c2->data = 100; c2->next = NULL; Cell *c1; c1 = (Cell *)malloc(sizeof(Cell)); c1->data = 200; c1->next = NULL; c1->n...
C
/*You will be given 3 integers as input. The inputs may or may not be different from each other. You have to output 1 if all three inputs are different from each other, and 0 if any input is repeated more than once. Input ----- Three integers on three lines. Output ------ 1 if the three inputs are different f...
C
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //4. Write a program which creates two thread, and by using appropriate synchronization technique avoid the scheduling problem. //Date : 15-10-2020 ///////////////////////////////////////////...
C
// Write a C Program to sort elements in Lexicographical Order (Dictionary Order) #include<stdio.h> #include<string.h> int main() { int n; printf("Enter number of words\n"); scanf("%d",&n); char a[n][50]; printf("Enter %d words\n",n); gets(a[0]); for(int i=0;i<n;i++) gets(a[i]); ...
C
#include <stdio.h> #include <stdlib.h> #include "file.h" file* creerFile (int taille){ file* f = (file*)malloc(sizeof(file)); f->t = (sommetParcours**)malloc(sizeof(sommetParcours*)*taille); f->taille = taille; f->tete = 0; f->queue = 0; return f; } void detruireFile (file* f){ free(f->t); } int fileVide (fi...
C
/*$ -fno-inline $*/ #include <stdio.h> int cse1(int a) { int x = a * 3; int y = 3 * a; return x + y; } int cse2(int a, int b) { int x = a * b; int y = b * a; return x - y; } int main() { printf("cse1(3) = %d (should be 18)\n", cse1(3)); printf("cse2(3,4) = %d (should be 0)\n", cse2(3,4)); return 0;...
C
#include <stdio.h> int main(void) { float a,b,c; printf("请输入实数a:");scanf("%f",&a); printf("请输入实数b:");scanf("%f",&b); printf("请输入实数c:");scanf("%f",&c); if (a==b && a==c) printf("1\n"); else if(a==b || a==c || b==c) printf("2\n"); else if (a+b>c && a+c>b && b+c>a ) printf("3\n"); else printf("0\n"); retu...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_printxX.c :+: :+: :+: ...
C
/*==========================================================================*/ /* SEED reader | find_type43 | station header */ /*==========================================================================*/ /* Name: find_type43 Purpose: print channel poles and zeroes response table to s...
C
#include <stdio.h> int main() { int lines_counter, character = 0; lines_counter = 0; while ((character = getchar()) != EOF) { if (character == '\n') { ++lines_counter; } } printf ("%ld\n", lines_counter); return 0; }
C
#include "ctrlmgr_loop.h" FILE *fp; void ctrl_loop_run(SharedStatus *status){ int running = 1; OperationStatus stat; fp = fopen("test.txt", "w"); while(running){ stat = dispatch_cmd(status); pthread_mutex_lock(status->lock); if(status->state->run_status != RUNNING){ runni...
C
#include<stdio.h> #include<conio.h> int ITEM,FRONT,REAR,QUEUE[10]; void insert(int ITEM) { if(FRONT==1 && REAR==10 || FRONT==REAR+1) { printf("OverFlow Condition"); } if(FRONT==NULL) { FRONT=1; REAR=1; } else { REAR=REAR+1; } QUEUE[REAR]=ITEM; } void delet() { if(FRONT==NULL) { printf("UnderFlow ...
C
/* Copyright (c) 1986 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ /* This module is created for NLS on Sep.03.86 */ #ident "@(#)wsncat.c 1.6 93/12/0...
C
double x = 1.23456; /* 預設顯示 6 位 */ printf("x = %lf\n", x); /* 整體寬度佔 10 個長度 (含 "點" 與 "小數") */ printf("x = %10lf\n", x); /* 顯示小數點 2 位 */ printf(" x = %.2lf\n", x); /* 整體寬度佔 10 個長度 顯示小數點 2 位*/ printf(" x = %10.2lf\n", x); /* 寬度、小數位數由變數控制 */ int width = 10; int precision = 2; printf(" x = %*lf\n", width, x...
C
/*Given a number N. Write a program to check whether every bit in the binary representation of the given number is set or not. Input: First line of input contains a single integer T which denotes the number of test cases. T test cases follows. First line of each test case contains a single integer N which denotes the ...
C
#include <stdio.h> #include <stdarg.h> void GhiVaoTep(FILE* file, const char type, size_t size, ...); void thongBao(char* argc, ...); int main() { int a, b, c; FILE* file = fopen("input.txt", "r"); GhiVaoTep(file, 'd', 3, &a, &b, &c); fclose(file); thongBao("abc", a, b, c); } void GhiVaoTep(FILE*...
C
/***************************User's declarations********************************/ #include <stdio.h> /* printf */ #include <assert.h> /* assert */ #include "bst.h" /**********************assistance functions declarations***********************/ int IntCompare(const void *data1, const void *data2, void *param); int Ad...
C
#include<stdio.h> #include<stdlib.h> void BST_insert(); void BST_delete(); void infixorder(); void levelorder(); void menu(); void addq(); void deleteq(); void infixorder(); void levelorder(); typedef struct node { int val; struct node* left; struct node* right; struct node* parent; ...
C
#include <stdio.h> int main() { FILE *file = fopen("/home/malah/Code/IMIE/CPP/filemake/tocopie", "r"); int c; while ((c = getc(file)) != EOF) { putchar(c); } fclose(file); return 0; }
C
#include <stdio.h> #include <stdlib.h> void merge (int *left, int *right, int n, int m); void mergesort (int *arr, int n); long long swaps; void merge (int *left, int *right, int n, int m) { if (n > 1) mergesort (left, n); if (m > 1) mergesort (right, m); int i = 0, j = 0, size = n + m, *arr = (int *) malloc (s...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* get_next_line_utils.c :+: :+: :+: ...
C
/* 8. Accept character from user. If it is capital then display all the characters from the input characters till Z. If input character is small then print all the characters in reverse order till a. In other cases return directly. Input : Q Output : Q R S T U V W X Y Z Input : m Output : m l k j i h g f e d c ...
C
//WAP to enter the two numbers and perform all arithmetic operators #include<stdio.h> #include<math.h> int main(){ int a ,b; printf("Enter the 1st number:\n"); scanf("%d\n",&a); printf("Enter the 2nd number:\n"); scanf("%d\n",&b); int z=a*b; printf("The value of z is %d\n "...
C
/* * Week_4 This program opens and reads a file of integer into an array and places * the values into a binary tree structure. Walks the tree "inorder" and prints * the values to the screen. */ #include <stdio.h> #include <stdlib.h> typedef struct intNumber { int data; struct intNumber * left; struct intNumber...
C
#include<stdio.h> main() { int a=0x12131415; short int *sh=(short int *)&a; int i=0,n=2; for(i=0;i<n;i++) { printf("%x",*sh); sh++; } }
C
#ifndef __WMWM__LIST_H__ #define __WMWM__LIST_H__ typedef struct list_item list_t; struct list_item { void *data; list_t *prev; list_t *next; }; /* * Move element in item to the head of list mainlist. */ void list_to_head(list_t **mainlist, list_t *item); /* * Create space for a new item and add it to the hea...
C
// Mutual exclusion lock. #define _check_lock(lock, massage) do{\ if(!holding(lock)) \ panic(massage);\ }while(0)\ struct spinlock { uint locked; // Is the lock held? // For debugging: char *name; // Name of lock. int cpu; // The number of the cpu holding the lock. uint pcs[10]; // The c...
C
// Author: Benjamin Mayes #include <stdio.h> #include <string.h> #include <stdlib.h> #include <limits.h> // the type of element that the heart consists of typedef struct _heart_entry heart_entry; struct _heart_entry { unsigned int h; int paths; }; // the adjacency matrix unsigned int** adjacency_matrix; //ad...
C
#include <stdio.h> #include <stdlib.h> int main() { int n; float* a = NULL; printf("Enter array size: "); scanf("%d", &n); if (n < 1) { printf("Invalid size!"); return 1; } a = (float*)malloc(n*sizeof(float)); if (a == NULL) { printf("Mem error!"); re...
C
#include "MyString.h" #include <stdio.h> #include <assert.h> #define ZERO 0 unsigned int countSubStr(const char* str1, const char* str2, int isCyclic); int length (const char* string); unsigned int check(const char* str1, const char* str2, int forSize); /** * * @param str1 the first string we compare with * @...
C
/** @file source_untrusted.h * * @brief Helper utilities for validate and get data from untrusted source * * All function inside is non-thread safe nor interrupt safe. Generally the * caller use memlock to protect thread safeness, while avoid calling it inside * interrupt handler to allow interrupt unsafeness...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> int main() { char string1[] = "napis1"; char string2[] = "napis2"; char *result; printf("%s", &string1); printf("%s", &string2); result=strcatt(string1,string2); printf("%s", &result); return 0; } char *strcatt(ch...
C
#include <stdlib.h> #include <stdio.h> #include <string.h> #include <stdbool.h> #include <unistd.h> #include <ctype.h> #include <sys/types.h> #include <sys/socket.h> #include <netdb.h> #include <netinet/in.h> #include <arpa/inet.h> #include <fcntl.h> #include <sys/select.h> #include <errno.h> #include <time.h> #define...
C
#include <omp.h> #include <stdio.h> static long num_steps = 10000000; double step; void main () { int i; double x, pi, sum = 0.0; double start_time = omp_get_wtime(); step = 1.0/(double) num_steps; #pragma omp parallel num_threads(2) private(i,x) { #pragma omp for reduction(+:sum) schedule(static) fo...
C
/*WAP to insert item in unsorted array*/ #include<stdio.h> #define size 20 main(){ int a[size],i,n,item; printf("enter num. of element: "); scanf("%d",&n); /*creat array*/ for(i=0;i<n;i++){ printf("enter number %d: ",i+1); /*index of array starts with 0 and user knows start as 1*/ scanf("%d",&a[i]); ...
C
// RLG20141229 #include <avr/io.h> #include <util/delay.h> int main(void) { DDRB |= 0b00100110; // leave all the other bits alone, just set bit 1 (PB1), 2 (PB2), & 5 (PB5) by or'ing with 00100110 DDRC &= 0b11111011; // leave all the other bits alone, just clear bit 2 (PC2) by anding with 1111 1011 // PORTC |= (1 <<...
C
#include "defs.h" int init(SDL_Window **g_Window,SDL_Renderer **renderer) { SDL_Surface *icon=NULL; if(0 != SDL_Init(SDL_INIT_VIDEO)) { printf("Erreur SDL_Init : %s\n", SDL_GetError()); return -1; } if(0 != TTF_Init()) { printf("Erreur TTF_Init : %s\n", SDL_GetError()); ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* choose_flag.c :+: :+: :+: ...
C
// this is a merge sorting algorithm // time complexity: O(n*Log n) #include<stdio.h> #include<stdlib.h> void merge(int A[],int l,int m,int r) { int i,j,k; int n1=(m-l)+1; int n2=r-m; int L[n1],R[n2]; for(i=0;i<n1;i++) L[i]=A[l+i]; for(j=0;j<n2;j++) R[j]=A[m+1+j]; i=0; j=0; k=l; while(i<n1&&j<n2) { if(L[i]<=...
C
/***********************************************************************/ /* Anyone is free to copy, modify, publish, use, compile, sell, */ /* dismantle, dismember or distribute this software, either in source */ /* code form or as object code or assembly code, for any purpose, */ /* commercial or non-com...
C
/* ID: ronak.b1 LANG: C TASK: crypt1 */ #include <assert.h> #include <limits.h> #include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #define i64 long long #define uint unsigned int #define MAX(a, b) ( a > b ? a : b ) #define MIN(a, b) ( a < b ? a : b ) char numset[10]; int numarr[10]; char ...
C
// CODE: DMS Assignment Problem-35 #include <stdio.h> int main() { int C; printf("\nGiven the Truth values of P and Q:\n\n"); printf(" P | Q\n"); printf("-------\n"); printf(" T | T\n T | F\n F | T\n F | F\n"); printf("\n INSTRUCTIONS: Enter a correct choice\n"); printf("\t1. Conjuntion\...
C
#define _CRT_SECURE_NO_WARNINGS #include "stdio.h" #include "graph.h" #define ERROR_WRONG_VERTEX_NUM 1 #define ERROR_WRONG_EDGE_NUM 2 #define ERROR_WRONG_LINES_NUM 3 int checkInput(FILE * fout, int vert, int edge); int main() { int vert_num = -1, edge_num = -1; int i, ver1, ver2; FILE * fin = fop...
C
#include <stdio.h> #define VALUE_BITS 8*sizeof(int) bitPrint(int n, unsigned m) { if (0==m) return; bitPrint(n,m<<1); printf("%d",0!=(n&m)); } int bitRev(int value) { int result = 0; for(int i = 0; i < VALUE_BITS; i++) { result = (result << 1) | (value & 1); value >>= 1; ...
C
#include <stdio.h> #include <unistd.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> FILE *out; int main () { int Ssocket = socket (AF_INET, SOCK_STREAM, 0); struct sockaddr_in myaddr, clientaddr; myaddr.sin_family = AF_INET; myaddr.sin_port = htons(4000); myaddr....
C
#include<stdio.h> int main(){ for(int i=0; i<128; i++){ printf("DECIMAL = %d : ASCII = %c\n",i,i); } return 0; }
C
/* * Exam 2 Program 2 * Written by: Tyler Duong, Nikki Abedi, Jasmine Sourinthone * CS36 9/5/19 */ #include <stdio.h> #include <stdlib.h> #include <time.h> int roll( int min, int max ) //return a random number between 1 and 6 { return (rand() / ((double)RAND_MAX+1)) * (max-min+1) + min; } int...
C
// // Created by shhan on 12/26/16. // #include "sh_list.h" SH_LinkedList_t *SH_LinkedListNew(void) { SH_LinkedList_t *l = NULL; l = (SH_LinkedList_t *)malloc(sizeof(SH_LinkedList_t)); if (l) { memset(l, 0, sizeof(*l)); } return l; } RETCODE SH_LinkedListAdd(SH_LinkedList_t *list, void *data) { if (list) ...
C
#include "usart.h" void Uart1_Init(u32 bound) { RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE); GPIO_PinAFConfig(GPIOA, GPIO_PinSource9, GPIO_AF_1); GPIO_PinAFConfig(GPIOA, GPIO_PinSource10, GPIO_AF_1); GPIO_InitTypeDef GPIO_InitStructure; GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9; GPIO_In...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <signal.h> static const int blsize = 100; static unsigned char byte = 0; static unsigned char offset = 1; static const unsigned char max_offset = (1 << 7); static int ch_pid; static unsi...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> #include <ctype.h> /** * main - Entry point and execute the ramdon number * * Return: 0 */ int main(void) { char l; char u; for (l = 'a'; l <= 'z'; ++l) putchar(l); for (u = 'A'; u <= 'Z'; ++u) putchar(u); putchar('\n'); return (0); }
C
/** * hilo.c, by Lawrence Buckingham on 08 March 2020. * (C) 2020 Queensland University of Technology. */ #include <stdio.h> #include <time.h> #include <stdlib.h> int main () { // Think of a number srand(time(NULL)); int secret = 1 + rand() % 100; int guess; // Forever... while (1) { printf("I'm thinking ...
C
#ifndef NO_IDENT static char *Id = "$Id: putraw.c,v 1.4 1995/06/04 17:08:54 tom Exp $"; #endif /* * Title: putraw.c * Author: Thomas E. Dickey * Created: 12 Nov 1984 * Last update: * 03 Jun 1995, prototyped * * Function: Print a null-ended string on the terminal. Unlike 'printf', * this VMS function will no...
C
/* - STRCSPN.C - The ANSI "strcspn" function. $Revision: 328482 $ Copyright 1986 - 1999 IAR Systems. All rights reserved. */ #include "string.h" size_t strcspn(const char *s1, const char *s2) { #ifdef _INTRINSIC return strcspn(s1, s2); #else char *v; size_t n = 0; while (*s1)...
C
/*! @file * * @brief Routines for controlling the Real Time Clock (RTC) on the TWR-K70F120M. * * Implementation of functions for operating the real time clock (RTC). * * @author Mohammad Yasin Azimi, Scott Williams * @date 2016-10-31 */ /*! * @addtogroup RTC_module RTC module documentation * @{ */ #inclu...
C
/* ============================================================================ Name : server.c Author : TM Version : Copyright : Your copyright notice Description : Hello World in C, Ansi-style ============================================================================ */ #include <stdio.h...
C
/* ============================================================================ ANEXO 5-1: Armar un Men de Opciones con las siguientes opciones: 1-Inicializar 2-Cargar 3-Mostrar 4-Calcular Promedio 5-Ordenar Al ingresar a cada opcin del men deber imprimir en pantalla el nombre del mismo. Ej: Si se presiona la opcin 1...
C
#include<stdio.h> #include<string.h> #include<stdlib.h> enum{MAX=81,LINE=5}; typedef struct dt {char model[50],phangiai[10];float store,gia;}dt; void conv_dat(FILE *f1,FILE *f2) { float store,gia; char ten[50],pg[50]; dt a; while(fscanf(f1,"%s",ten)!=EOF) { strcpy(a.model,ten); fscanf(f1,"%f",&s...
C
#include<stdio.h> #include<stdlib.h> #include<time.h> #define n_of_n 50 unsigned long long gen_random() { unsigned long long n=0; int ten=1; //srand(time(NULL)); for(int i=0;i<20;i++) { n=n+abs(ten*(rand()%9+1)); ten*=10; } return (n); } //function to generate prime numbers--------------------------------...
C
#include "Array.h" /* Perform an element by element subtraction of one vector from another, where v3[i] = v1[i] - v2[i] and return the resulting vector. */ Vector sub(Vector v1, Vector v2){ int count = v2.count; Vector negV2; negV2 = create_vector(count); int x; for(x = 0; x < count; x++) { double...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> int zufallszahlen(int max, int min) { int rz; rz = (rand() % (max - min + 1) + min); return rz; } void ziehung(int f[], int anzahl, int max, int min) { for(int i = 0; i < anzahl; i++) { f[i] = zufallszahlen(max, min); } for(int j =...
C
/* Escreva duas funções para ordenar um vetor de números de forma crescente. Escreva uma função recebendo um arranjo e outra recebendo um ponteiro. Em seguida, chame estes módulos a partir de um módulo main para testar seu programa. */ #include <stdio.h> #include <stdlib.h> void escreverVetor(int v[], int colunas) { ...
C
#include<stdio.h> int main(int argc, char const *argv[]) { if (argc==2) { printf("You suck you have only one argument\n"); }else if(argc>2 || argc<4){ printf("Here are your arguments\n"); for (int i = 0; i < argc; ++i) { printf("%s\n",argv[i] ); } }else if(argc>10){ printf("You have too many argume...
C
const int GAMEBOARD_SIZE = 3; int *ptrToRow; int *ptrToCol; void PrintBoard(char board[GAMEBOARD_SIZE][GAMEBOARD_SIZE]) { char newBoard[GAMEBOARD_SIZE][GAMEBOARD_SIZE] = { {0, 0, 0}, {0, 0, 0}, {0, 0, 0} }; for (int row = 0; row < GAMEBOARD_SIZE; row++) { for (int col = 0; col < GAMEBOARD_SIZE; col++) { ...
C
#ifndef ERRORS_H #define ERRORS_H #include <stdlib.h> #include <stdio.h> typedef const char* strings[]; static inline void errorArray(int count, const char* strs[]) { for (int i = 0; i < count; i++) fputs(strs[i], stderr); } static inline void error(const char* type, const char* message) { errorArra...
C
#include<stdio.h> main() { int num,i; for(num=10;num<=15;num++) { for(i=1;i<=10;i++) { printf("%d * %d = %d\n",num,i,num*i); } } printf("\n"); }
C
#include<stdio.h> #include<math.h> /* This file initially contained a piece of code that checks is a number is prime or not Added a function that checks if a number is even or odd as well */ char* getResultStringValue(int num) { if(num==0) { return "its even"; } else {...
C
#include <stdio.h> #include <string.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <stdlib.h> #include <sys/resource.h> #include <wait.h> #include <errno.h> #include <signal.h> #include <setjmp.h> #include <time.h> #include <stropts.h> #include <sys/mman.h> #include <s...
C
// C program to store, count, detect lengths of words in an array #include <stdio.h> #include <string.h> #include <cs50.h> int main() { // Enter nonsentence words into array // (with space added for further code applying reasons in file findwordintext.c) char words_array[][10] = { "Mr. ", "Mrs. ", "MR. ", "MRS. "}...
C
#include <stdio.h> #include <stdlib.h> #include <ctype.h> #include <pthread.h> int SharedVariable = 0; pthread_mutex_t lock; pthread_barrier_t barrier; void SimpleThread(int which) { int num, val; for (num = 0; num < 20; num++) { if (random() > RAND_MAX/2) { usleep(10); } pthread_mutex_lock(&lock); val =...
C
char chrtobyte(char); void include(unsigned *, char); void exclude(unsigned *, char); unsigned substr(unsigned, unsigned); unsigned intersection(unsigned, unsigned); unsigned getunion(unsigned, unsigned); unsigned difference(unsigned, unsigned); char in(char, unsigned); char chrtobyte(char c){ c-=48; return c; } v...
C
#include <stdio.h> #include <stdbool.h> #include <stdlib.h> #include <string.h> #include <winsock2.h> #include <conio.h> #define MAX 5000 #define PORT 12345 #define SA struct sockaddr int client_socket, server_socket,menustate; char javabserver[1000],authtoken[32]; void makesocket(); void registeruser(); v...
C
#include<stdio.h> #include<stdlib.h> void merg(float *b,float *c,int x,int y,float *a); void mersort(float *a,int n); int main() { int i,j,m,l,u,v,x=0; float a[10500]; char ch[10500]; FILE *p,*q; p=fopen("NUMBERS","r"); q=fopen("OUTPUTS","w"); if(p==NULL){ printf("No contents to read\n"); } else { { i=0; j=0; while(fsc...
C
/* * File: lab10.c * Author: Alejandro Duarte * * Created on 3 de mayo de 2021, 01:11 AM */ #include <xc.h> #include <stdint.h> #include <stdio.h>// Libreria para poder usar printf junto a la funcion putch. //------------------------------------------------------------------------------ // ...
C
#ifndef _VEC3_H_ #define _VEC3_H_ //! simple 3D vector typedef struct Vec3 { float values[3]; } Vec3; //! dest = a*alpha_a+b*alpha_b void v3compose(Vec3* dest, const Vec3* a, const Vec3* b, float alpha_a, float alpha_b); //! returns the scalar product of a and b float v3dot(const Vec3* a, const Vec3* b); //! des...
C
#include <stdio.h> #include <stdlib.h> #include <obliv.h> #include <string.h> #include <assert.h> #include "util.h" #include "dbg.h" // pretty debugging #include "pseudonymize.h" #define BUFFER_SIZE 64 // this should be enough? emails are hopefully 20 characters max . . . void check_mem(person* fullData, int party) ...
C
#include <stdint.h> #include <stdbool.h> #include "em_device.h" #include "em_chip.h" #include "em_cmu.h" #include "em_emu.h" #include "em_gpio.h" #include "em_lcd.h" #include "em_system.h" #include "segmentlcd.h" /* Max number of HFCycles for higher accuracy */ #define HFCYCLES 0xFFFFF /* HF_cycles x ref_fr...
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 "dog.h" /** * init_dog - Intialize the dog structure * @d: Pointer to the dog structure * @name: the name * @age: the age * @owner: the owner * * Return: Always 0. */ void init_dog(struct dog *d, char *name, float age, char *owner) { if (d != NULL) { d->name = name; d->age = age; d->owner = ow...
C
#include <stdio.h> #include <stdlib.h> #include<windows.h> #include<time.h> int i,j; int start(); int display(); COORD coord={0,0}; int tic[10]; int tic1[10]={'0','1','2','3','4','5','6','7','8','9'}; void gotoxy(int x,int y) { coord.X=x; coord.Y=y; SetConsoleCursorPosition(GetStdHandle(STD_...
C
#include "holberton.h" /** * _strncat - concatenates two words. * @dest: output * @src: input * @n: lent; * Return: x. */ char *_strncat(char *dest, char *src, int n) { char *x = dest; int largo = 0; int dest_len = largo; int i; for (; *dest != '\0' ; dest++) { largo++; } for (i = 0 ; i < n && src[i] != '\0' ; i+...
C
// Copyright Nettention Inc. // MIT License. #pragma once #include <stdint.h> // compares two binarys and returns negative if 1 is smaller, positive if 1 is bigger, or 0 if same. inline int LexicographicBinaryCompare32(const void* pBinary1, int binary1Length, const void* pBinary2, int binary2Length) { int bigLeng...
C
#include <stdio.h> #include <stdbool.h> #include <stdlib.h> struct array_queue { int* data; int size; int head; int tail; }; bool init_queue(struct array_queue* queue, int size) { queue->data = malloc(sizeof(int) * size); if (queue->data == NULL) { printf("data malloc error\n"); ...
C
#include <stdio.h> #include <stdlib.h> /* ornek1:struct ogrenci { char ad[20]; char soyad[20]; char bolum[50]; int sinif; int numara; float ortalama; }ogr; //ornek 2: struct kitaplar { char ad[20]; char yazar[50]; float fiyat; }ktp1={"kayip sicil","soner yalcin",17.99},ktp2={"ilk ask...
C
#include <stdio.h> #include <stdlib.h> #include "string.h" int firstUniqChar(char * s){ int i, alphaList[26]; //第一次存入数组 for(i=0;i<strlen(s);i++){ alphaList[s[i] - 'a'] += 1; } //第二次提取判断第一个值为1的 for(i=0;i<strlen(s);i++){ if(alphaList[s[i] - 'a'] == 1)return i; } return -1;...
C
/* CSSE332 FAT12 Implementation - util.h * Header file containing function prototypes and structures for use * in implementing the FAT12 filesystem. Function definitions are contained * in util.c */ #include <stdio.h> #define T_SUBDIR 1 #define T_FILE 0 #define T_FAT12 1 #define T_NFAT12 0 #define SHM_KEY 6543 #...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> #include "mesh.h" void clean(Domain *D) { Edge *eg,*tmpEdge; //remove edge eg=D->hull->eg; while(eg) { tmpEdge=eg->next; D->hull->eg=tmpEdge; eg->next=NULL; free(eg); eg=D->hull->eg; } free(D->hull); }
C
// Variable table // ============== // Author: Celestial Phineas @ ZJU // (Yehang YIN) // This file implements a hash table for storing variables // In bash, variables are also lists. // myshell works in the same manner. // All entries of the hash table are lists of strings. // Each records elec, element count ...
C
void magfime() { int tema,continuar; do { do { p("Las magnitudes f%csicas y su medida:\n",161); p("===================================\n\n"); p("[1] - El sistema m%ctrico decimal.\n",130); p("[2] - El sistema internacional de unidades.\n"); p("[3] - Conversiones de unidades con factores de conversi...
C
#include <stdio.h> int main(void) { int nb1, nb2, nb3, nb4, somme; printf("Entrez un premier nombre: "); scanf("%d", &nb1); printf("Entrez un deuxieme nombre: "); scanf("%d", &nb2); printf("Entrez un troisieme nombre: "); scanf("%d", &nb3); printf("Entrez un quatrieme nombre: "); scanf("%d...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* list_functions.c :+: :+: :+: ...
C
/////////////////////////////////////////////////////////////////////////////// // // Comments: // sudo insmod hello_world.ko PRINT_COUNT=5 // This will result in the hello world greeting printed 5 times // // To see the value of PRINT_COUNT after the driver is inserted // sudo cat /sys/modules/hello_world/parameters/P...
C
#include <stdio.h> int main(void) { int P, L,i,num=0; int a[5]; scanf_s("%d", &L); scanf_s("%d", &P); for(i=0;i<5;i++){ scanf_s("%d", &a[i]); } num = P*L; for (i = 0; i < 5; i++) { printf("%d ", a[i]-num); } return 0; }