language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
/* * TM1638Berat.c * * Author: Berat Kaya * Inspiration: https://github.com/lpodkalicki/attiny-tm1638-library/blob/master/tm1638.h * Har sgt inspiration fra ovenstende git repos. */ #define F_CPU 16000000 #include <avr/io.h> #include <avr/pgmspace.h> #include <util/delay.h> #include "TM1638.h" //TODO:: Define ...
C
/*! Tests for the colr_replace* macros/functions. \author Christopher Welborn \date 12-29-2019 */ #include "test_colr_replace.h" describe(colr_replace) { subdesc(colr_replace_str) { /* strings */ it("replaces with strings") { // helpers.colr_str_replace already tests colr_str_re...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/socket.h> #include <linux/if_ether.h> #include <sys/ioctl.h> #include <net/if.h> #include <net/ethernet.h> /** * Set misc mode for interface * \param if_name interface name we will set * \param sockfd the socket id we will set * ...
C
#include<stdio.h> #include<singlylinkedlist.h> int main() { node *n; create_sll(&n); int op, on, num, po, e, f, len, cont, position, sea, key; do { printf("ENTER AN OPTION\n"); printf("1. INSERT A NODE\n2. DELETE A NODE\n3. SEARCH AN ELEMENT\n4. CHECK IF THE LINKED LIST IS EMPTY\n5. CHE...
C
/* Example to illustrate conditional compilation */ #include <stdio.h> #include <stdlib.h> #define ACME #define DEBUG 1 struct statement { char name[30]; #if defined(ACME) char account[10]; #else char department[20]; #endif float balance; struct { #ifdef ACME char tCode[10]; #elif DEBUG int tCod...
C
#include <stdio.h> // Iterative function to calculate gcd of two numbers int euclidi(int a, int b) { int t, s; while (b > 0) { t = a / b; s = a - t * b; a = b; b = s; } return a; } // Recursive function to calculate gcd of two numbers int euclidr(int a, int b) { if (b == 0) return a; int q = a / b; ...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> #define MAXSIZE 20 /* 存储空间初始分配量 */ typedef int ElemType; /* ElemType类型根据实际情况而定,这里假设为int */ typedef struct { ElemType data[MAXSIZE]; /* 数组,用于存储数据元素,长度为MAXSIZE */ int length; /* 线性表当前长度 */ } SqList; SqList I...
C
/* * @file: UART.c * @company: ITESO * @Engineer Team: D.F.R. / R.G.P. */ #include "UART_driver.h" uart_mail_box_t g_mail_box_uart_0; void UART0_RX_TX_IRQHandler( ) { while (!(UART0->S1 & UART_S1_RDRF_MASK)) { // Codigo Bloqueante } g_mail_box_uart_0.mailBox = UART0->D; g_mail_box_ua...
C
// Jonathan Fokkan // 260447938 // Question 3 // Assignment 4 #include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct password_rec { char username[50]; char password[50]; char usertype[50]; }PASSWORD_REC; typedef struct node { PASSWORD_REC user; struct node *next; } NODE; int ...
C
#include "test.h" int; int g0; int f0(){g0=200; return g0;} int g1; int f1(){g1=100; return f0()-g1;} int g2; int g3, g4; int g5; int g6; int g7=-1, g8=2, *g9, g10=3; int g11={7}; int main() { ASSERT(1, ({int a=1; a;})); ASSERT(2, ({int z=2; z;})); ASSERT(30, ({int a=1, b=2, c=3; a=b=c; a*10;})); ASSERT(123, ...
C
#include <stdio.h> #include <stdlib.h> #include "Queue.h" typedef struct QUEUEnode *link; struct QUEUEnode { Edge item; link next; }; struct queue { link head; link tail; int size; }; link NEW(Edge e, link next) { link x = malloc(sizeof *x) ; x->item = e; x->next...
C
#include <stdio.h> #include <cs50.h> int main(void) { int type = get_int("Enter type of pattern (1 or 2) "); if (type==1 || type==2) { int row = get_int("Number of rows"); int i=0,j=0,space=0; switch(type) { case 1 : for(i=row;i>=1;i--){ for(j=1;j<=i;j++) { printf("#"); } pri...
C
#include <stdio.h> void funcB(int arg) { int i; printf("Inside Thread Function B\n"); for(i=0;i<5;i++) { printf("Thread B in loop\n"); } printf("Terminating Thread B\n"); } void funcC(int arg) { int i; printf("Inside Thread Function C\n"); for(i=0;i<5;i++) { printf("...
C
/** * feature.c * earth * November 07, 2012 * Brandon Surmanski */ #include <stdlib.h> #include "clockwork/util/math/scalar.h" #include "feature.h" void feature_init(Feature *f, int w, int h) { f->w = w; f->h = h; f->arr = malloc(sizeof(uint16_t) * w * h); } void feature_finalize(Feature *f) { ...
C
#include <string.h> #ifndef bool #define bool int #endif static int contain(char *s, int start, int len, char **wordDict, int wordDictSize) { int i; for (i = 0; i < wordDictSize; i++) { if (strlen(wordDict[i]) != len) continue; if (!strncmp(s + start, wordDict[i], len)) return(1); } return(0); } bo...
C
/******************************************** files.c copyright 1991-94,2014-2016 Michael D. Brennan This is a source file for mawk, an implementation of the AWK programming language. Mawk is distributed without warranty under the terms of the GNU General Public License, version 3, 2007. If you import elements of ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* main.c :+: :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> #include <sys/stat.h> int main(void) { FILE * fp = fopen("cat2.c","r"); if (fp == NULL){ perror("fopen"); return 1; } struct stat stats; if (fstat(fileno(fp),&stats)== -1){ // POSIX only perror("fstat"); return 1; } ...
C
#include <stdio.h> #include <stdlib.h> #include <ctype.h> #define MaxElements 10 // typedef int HeapElementType; // typedef struct { int key; HeapElementType Data; } HeapNode; typedef struct { int Size; HeapNode Element[MaxElements+1]; } HeapType;...
C
#include "queue.h" #include "safe_stdlib.h" void initQueue(Queue *queue, int n){ queue->begin = 0; queue->end = 0; queue->n = n + 1; queue->list = (int *) safeMalloc(queue->n * sizeof (int)); } void releaseQueue(Queue *queue){ free(queue->list); } void push(Queue *queue, int elem){ queue->li...
C
/* Note:Your choice is C IDE */ #include "stdio.h" #include"string.h" void main() { char s[10][10],c[10]; int i,j; for(i=0;i<10;i++) { gets(s[i]); } for(j=0;j<10;j++) { for(i=1;i<10;i++) { if(strcmp(s[i],s[i+1])==-1) { strcpy(c,s[i]); s...
C
#ifndef OC8_BIN_PRINTER_H_ #define OC8_BIN_PRINTER_H_ //===--oc8_bin/printer.h - human-readable printer for file_t ------*- C -*-===// // // oc8_bin library // Author: Steven Lariau // //===----------------------------------------------------------------------===// /// /// \file /// Define struct oc8_bin_printer_t, us...
C
/* Lab 3 Spring 2015 * Vincent Chan 815909699 */ #include <stdio.h> #include <math.h> typedef struct { float x; float y; float z; } vector; vector getVector(void); void printVector(vector v); vector addVectors(vector* v1, vector* v2); float magnitude(vector* v); /**Main function*****************************...
C
#include <stdio.h> //函数功能:读取文本文件中的行数 int CountLines(char fileName[]); //函数功能:读取文本文件中第n行的数据 char *ReadLine(char fileName[],int n); //函数功能:删除第n行的数据 void DeleteLineData(char *fileName,int n); //函数功能:修改某一行的数据 void ChangeLineData(char *filename,int n,char *data);
C
#include "../LinkedList/SingleLinkedList.h" void TopologicalSort( Vertex* V, Node** List ); void TS_DFS( Vertex* V, Node** List ); void TopologicalSort( Vertex* V, Node** List ){ while( V != NULL && V->Visited == NotVisited ){ TS_DFS( V, List ); V = V->Next; } } void TS_DFS( Vertex* V, Node** List ){ Node...
C
#define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward d...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, char **argv) { char* str = argv[1]; char* res; res= (char* ) malloc (strlen(str)*2+1); int dupCount=0; char currCarr; int containsDigits=0; int i; int buffboy=0; for (i=0; i < strlen(str); i++){ if (str[i] >= '0' && str[i]<='9...
C
/*************************************************************************************************/ /*! * \file bda.c * * \brief Bluetooth device address utilities. * * Copyright (c) 2009-2018 Arm Ltd. * * Copyright (c) 2019 Packetcraft, Inc. * * Licensed under the Apache License, Version 2.0 (the "Lic...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> int heap[100]; int last =1; void insert(int val) { int i, tmp; heap[last] = val; //printf("last %d heap[last] %d\n",last, heap[last]); if (last > 1) { //rebalance for (i=last; i>1; i=i/2 ) { if (val < heap[i/2]) { tmp = heap[i]; heap[i] = heap[...
C
#include <stdio.h> #include <fcntl.h> #include <unistd.h> #include <sys/mman.h> #include <stdlib.h> #include <sys/wait.h> int main() { unsigned long long N; scanf("%llu", &N); for (unsigned long long i = 1; i <= N; ++i) { pid_t pid = fork(); if (pid < 0) { printf("Failed...\n");...
C
#include<stdio.h> #include<string.h> //һַstrݵߵstrijȲ100ַ int main() { int i; char str[100]; gets(str); for(i=strlen(str)-1;i>=0;i--) { printf("%c",str[i]); } return 0; }
C
#include <stdio.h> #include <ctype.h> #include <stdlib.h> int main() { char *line, c; size_t maxsize = 32; int total = 0, decimal = 0, start = 0; // get line line = (char *) malloc(maxsize * sizeof(char)); getline(&line, &maxsize, stdin); // for char in line: printf("Got line: %s", line); if (line...
C
/* ** EPITECH PROJECT, 2018 ** main.c ** File description: ** main.c */ #include "get_next_line.h" #include <fcntl.h> void my_putchar(char c); void my_putstr(char *str); char *get_next_line(int fd); int main(int ac, char **av) { int fd = open(av[1], O_RDONLY); char *s; if (ac < 1 || ac > 2) my_...
C
/* * C Program that takes an Ordered Binary tree & Rearranges the * Internal Pointers to make a Circular Doubly Linked List out * of the Tree Nodes */ #include <stdio.h> #include <stdlib.h> struct node { int num; struct node *left; struct node *right; int used; }; void create(struct node **); void...
C
/* * Small/lib/string.c * * (C) 2012-2013 Yafei Zheng <e9999e@163.com> */ /* * ļں̬ûַ̬Լڴļ򵥴ע¼㣺 * * 1. Գ濪ͷ̣ԴַĿĵַҪͬĶУ * 2. "fs_"ͷ̣ݵַfsУ * 3. "fs_ds_"ͷģǰߵַfsУߵַdsУ * 4. "ds_fs_"ͷģǰߵַdsУߵַfsУ * 5. "fs2ds_"ͷģԴַfsУĿַdsУ * 6. "ds2fs_"ͷģԴַdsУĿַfsУ * ...... * * ʵϣĿû̬ں̬ʹãֻں̬ */ /********************************...
C
#include <stdio.h> #include <stdlib.h> #include <strings.h> #include <fcntl.h> #include <sys/time.h> #include <sys/file.h> #include <sys/types.h> #include <netinet/in.h> #include <string.h> /* ****************************************************************** ARQ NETWORK EMULATOR: VERSION 1.1 J.F.Kurose MODIFI...
C
/* * This is the banker. */ // Include Files. #include<stdio.h> #include<stdlib.h> #include<pthread.h> #include"helper.h" #include"banker.h" /* Takes a BankerData structure and corresponding data to initialize it. Return: 1 on succesfull initialisation. -1 if availableResourcesCount is less than ...
C
#include <ctype.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include "cube.h" #define ITERATE_PIECES(c, code) \ for (int i = 0; i < 6; i++) { \ Piece* p = c->faces[i]; \ code; \ } \ for (int ...
C
#include <stdio.h> #include <sys/system_properties.h> void main() { char osVersion[PROP_VALUE_MAX]; int osVersionLength = __system_property_get("ro.product.manufacturer",osVersion); printf("the hardware id is %s\n",osVersion); } int echo1(int a,int b) { int c = a+b; return c; } int echo2(int a,char b) { retu...
C
/** * @file simple_message_client.c * Verteilte Systeme * TCP/IP Programmieruebung * * TCP/IP Client * * @author Andrea Maierhofer 1410258024 <andrea.maierhofer@technikum-wien.at> * @author Thomas Schmid 1410258013 <thomas.schmid@technikum-wien.at> * @date 2015/12/13 * * */ /* * --------------...
C
#include <stdio.h> #include <sys/times.h> #include <unistd.h> #include <time.h> #include <math.h> #include <errno.h> #ifndef PROCDIR #define PROCDIR "/proc" #endif #ifndef PROCSTATFILE #define PROCSTATFILE PROCDIR "/stat" #endif #ifndef PROCMEMINFOFILE #define PROCMEMINFOFILE PROCDIR "/meminfo" #endif #define INTERVAL...
C
#include <stdio.h> #include <stdlib.h> #include <Math.h> /* run this program using the console pauser or add your own getch, system("pause") or input loop */ int main(int argc, char *argv[]) { int x, n, res; printf("\nValor de X: "); scanf("%d", &x); printf("\nValor de N: "); scanf("%d", &n); res = pow(x ...
C
#include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <String.h> #include "mainPilha.c" /* Q1 - DEC2HEX Escreva um programa que converta um numero decimal em hexadecimal, usando o metodo de divisoes sucessivas e uma pilha. OK - Obs. Lembrar que caso o resto da divisao for 10, 11, 12, 13, 14 ou 15, o...
C
#include<stdio.h> int main(){ long int t=0,n=0,i=0,count; long int a[101000],min; scanf("%ld",&t); while(t--) { count = 0; scanf("%ld",&n); for(i=0;i<n;i++) { scanf("%ld",&a[i]); } min = a[0]; for(i=0;i<n;i++) { if(a[i] < min) { min = a[i]; } } for(i=0;i<n;i++) { if(a[i]==...
C
#include<stdio.h> void fib(int f,int s,int n){ int t; if(n!=0){ t=f+s; printf("\t%d",t); fib(s,t,n-1); } } void main(){ int n; printf("Enter limit:"); scanf("%d",&n); printf("0\t1"); fib(0,1,n-2); printf("\n"); }
C
#include <stdio.h> #include <stdlib.h> #define MaxStackSize 100 typedef int DataType; #include "SeqStack.h" void main(void){ SeqStack myStack; int i,x; StackInitiate(&myStack); for(i = 0; i < 10 ; i++){ if (StackPush(&myStack,i+1) == 0){ printf("Push happened error!\n"); return ; } } if (StackTop(my...
C
#include <float.h> #include <limits.h> #include <stdio.h> int main(void) { printf("double型の最大値:%g\n", DBL_MAX); printf("double型の最小値:%g\n", DBL_MIN); printf("double型の精度:%d\n", DBL_DIG); printf("int型の最大値:%d\n", INT_MAX); printf("int型の最小値:%d\n", INT_MIN); return 0; }
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #define MAXSIZE 1001 int dp[MAXSIZE][MAXSIZE]; //用来保存状态 int lcm(char *src1, char *src2) { int n = strlen(src1), m = strlen(src2); int i, j; dp[0][0] = 0; for (i = 1; i <= n; i++) dp[i][0] = 0; for (i = 1; i <= m; i+...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* main.c :+: :+: :+: ...
C
#include <unistd.h> #include <stdlib.h> #include <sys/stat.h> #include <sys/types.h> #include <stdio.h> #include <sys/wait.h> #include <string.h> #include <sys/ipc.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <ctype.h> int main(){ printf("Server started \n"); int sd; int new_s...
C
//MPI.c #include "OS/OS.h" #include "OS/MPI.h" typedef struct { int PID_src; unsigned int size; char data[MESSAGE_SIZE]; } Message; typedef struct { int owner_PID; int num_messages; Message messages[MAILBOX_SIZE]; } Mailbox; /* * * Internal Datastructures * */ static Mailbox mailboxArray[MPI_SIZE...
C
#include <stdio.h> int main(void) { int count = 0; for(int i = 1; i <= 10; i++){ if(i > 3){ count++; } } printf("Numbers greater than 3 (range: 1 - 10): %d\n\n", count); return 0; }
C
#include<stdio.h> long findFactorial(int); int main() { int num = 6; long factorial = 1; while (num > 0) { factorial = factorial * num; num--; } long result = findFactorial(6); printf("Factorial is: %ld\n", result); } long findFactorial(int num){ if ( num > 0) { return...
C
#include <stdio.h> #include <pthread.h> /* Description of the first thread * which just prints a line in the command.*/ void myThread1(){ printf("This line is printed by thread 1\n"); return; } /* Description of the second thread * which just prints a line in the command.*/ void myThread2(){ printf("This is prin...
C
/* Tyler Pitsch TCSE 333 Assignment 2 10/20/17 Tested and compiled on Ubuntu 16.04 LTS Desktop 32-bit */ #include <stdio.h> #include <string.h> #define HEADER_SIZE 54 #define CONTRAST_RATIO 2.9695 int main(void){ char file[50];//name of the file we want to use, read as a string from user int width; int height; ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #define SIZE 100 #define BUFFER 500 typedef struct { char keresztnev[50]; int eletkor; char szak[50]; } HALLGATO; /* Hallgatói adatok feltöltése. */ int hallgatok_feltoltese(HALLGATO h[], const char *file, const char *separ...
C
/* & bitwise AND The bits in the result are set to 1 if the corresponding bits in the two operands are both 1. | bitwise inclusive OR The bits in the result are set to 1 if at least one of the corresponding bits in the two operands is 1. ^ bitwise exclusive OR The bits in the result are set to 1 if only one of...
C
/* proj03.c: project 3 for ARC autor: NAPISTE SVE JMENO A LOGIN */ #include <stdio.h> #include <stdlib.h> #include <time.h> #include <math.h> #include <mpi.h> /* definition of global data functions - uses NUM_OF_PARTICLES */ #include "globaldata.h" void usage(char *prog) { fprintf(stderr, "usage : %s filename tim...
C
//写一个函数使给定的3*3二维整型数组转置(行列互换) #include <stdio.h> void zz(int a[][3]) { for (int i = 0; i < 3; i++) for (int j = 0; j < i; j++) { a[i][j] += a[j][i]; a[j][i] = a[i][j] - a[j][i]; a[i][j] = a[i][j] - a[j][i]; } } int main() { int a[3][3]; for (int i =...
C
/* @JUDGE_ID: 10319NX 105 C */ #include<stdio.h> int map[20000]; int done = 0; int ori = 0; void build(int left, int right, int high) { int i; for(i=left+10000; i<right+10000; i++) if(map[i] < high) map[i] = high; } void draw(int end) { int i; for(i=done; i<end; i++) if(map[i] != ori){ printf...
C
#include<stdio.h> void main(){ char c; printf("Enter your character:"); scanf("%c",&c); if(c>64 && c<91) printf("The character you have entered is in HIGHER case\n",c); if(c>96 && c<123) printf("The character you have entered is in LOWER case\n",c); if(c>47 && c<58) printf("You have entered a number\n",c); if((c>...
C
/* Fabrizio Margotta 789072 */ /**************************************************************************** * * earthquake.c - Simple 2D earthquake model * * Copyright (C) 2018 Moreno Marzolla <moreno.marzolla(at)unibo.it> * Last updated on 2018-12-29 * * This program is free software: you can redistribute it ...
C
/* ** my_getdouble.c for Raytracer2 in /gfx_raytracer2/src/tools ** ** Made by Antoine Baché ** Login <bache_a@epitech.net> ** ** Started on Mon Apr 18 11:13:21 2016 Antoine Baché ** Last update Sun May 22 18:59:35 2016 Ludovic Petrenko */ #include "tools/memory.h" #include "tools/str.h" int my_power(int nb, cons...
C
#include<stdio.h> #include<math.h> #include "common.h" double cor_U(double R, double Rho) { double ri3,coru; ri3 = sig3/(R*R*R); coru = 2*M_PI*eps4*(Rho*sig3)*((ri3*ri3*ri3)/9-ri3/3); return coru; } double cor_P(double R, double Rho) { double ri3, corp; ri3 = sig3/(R*R*R); corp = 4*M_...
C
#include<stdio.h> int main(){ int ammount, total; printf("Enter your ammount: "); scanf("%d", &ammount); if ( ammount >= 1000 ) { printf("you have got 10%% discount\n"); total = ammount - (ammount/10); printf("Your ammount is = Rs. %d\n", total); } else { printf("ammount: %d\n", ammount); } retur...
C
#include <stdio.h> #include <stdlib.h> #include <stdint.h> int main() { int intnum = 8; double dub_num = 5; int num[5] = {1, 2, 3, 4, 5}; char letter = 'D'; char char_array[] = "Hello"; char name[] = "Huba"; char *p_name = name; printf("Memory size of an integer: %d\n", sizeof(intnum))...
C
#include "tp0.h" int main(void) { /*---------------------------------------------------PARTE 2-------------------------------------------------------------*/ int conexion; char* ip; char* puerto; char* valor; t_log* logger; t_config* config; logger = iniciar_logger(); log_info(logger,"Soy un log\n"); con...
C
#include <stdio.h> int main(int argc, char *argv[]) { int i = 0; int num_provinces= 4; // go through each string in argv // skipping the first arg because for (i = 1; i < argc; i++) { printf("arg %d: %s\n", i, argv[i]); } // let's make our own array of string char *provinces[] = { "Ontario", ...
C
#include <stdint.h> #include <stdbool.h> #include <stdlib.h> #include <string.h> #include <pthread.h> #include <errno.h> #include <syslog.h> #include "sqlite3.h" #include "sqlLib.h" static int sqlite2errno(int err); SqlStmt_t* sqlLib_createStmt(sqlite3 *db, const char *cmd) { bool success = true;...
C
#include <stdio.h> unsigned int seqnext(unsigned int n) { if (n % 2 == 0) return n/2; return 3*n + 1; } unsigned int seqlen(unsigned int n) { unsigned int len = 1; while (n != 1) { n = seqnext(n); len++; } return len; } int main(int argc, const char *argv[]) { unsi...
C
#include <stdio.h> #include <stdint.h> uint8_t a; //test with int //same as unsigned char uint16_t b; //unsigned short uint32_t c; //unsigned int uint64_t d; //unsigned long long uint32_t statusIO = 0; volatile uint32_t volatilestatusIO = 0; volatile uint32_t volatileStatusPtr = 0xE4321000; //volatileStatus...
C
#ifndef ADC_DRIVER_H #define ADC_DRIVER_H #include "avr_compiler.h" #define COMMEN_MODE_CYCLES 16 /* Macros */ /* This macro enables the selected adc. * * Before the ADC is enabled the first time the function * ADC_CalibrationValues_Set should be used to reduce the gain error in the * ADC. * * \note Af...
C
#include<stdio.h> #include<string.h> int main() { int l,ans,count=0,i; char str[20]; scanf("%[^\n]%*c",str); l=strlen(str); for(i=0;i<20;i++) { if(str[i]=='') { count++; } } ans=l-count; printf("\n%d",ans); return 0; }
C
// // prepare_arena.c // corewar // // Created by Alexander Volkov on 30/10/2019. // Copyright © 2019 Frost atronach Snow bear. All rights reserved. // #include "corewar.h" static t_champion *find_for_id(t_champion *ch, int id) { int i; i = 0; while (++i < 5) { if (ch->id == id) return (ch); ch = ch...
C
#include <stdio.h> #include <stdlib.h> #include <stdint.h> #define BLOCK_SIZE 512 int main(int argc, char *argv[]) { // Validate for one command-line argument if (argc != 2) { fprintf(stderr, "Usage: filename.raw\n"); return 1; } // remember filename char *infile = argv[1]; ...
C
// Sabino // Contm: // Exemplos matriz // CHAMADO DE BIBLIOTECAS #include <stdio.h> //#include <stdlib.h> //#include <string.h> //#include <conio.h> //#include <dos.h> //#include <windows.h> //#include <time.h> //#include <ctype.h> //#include <locale.h> //#include <math.h> /*EQUIVALENTE AO VISUALG ??? */ // Inc...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <errno.h> #include <unistd.h> extern char *optarg; int main(int argc, char *argv[]) { int ch; while ((ch = getopt(argc, argv, "ha:")) != -1) { switch (ch) { case 'h': fprintf(stdout, "Sample -h \n"); ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> //#define MAX 4 void sort_string(char *s[], int size); // ڿ ĺ void main(void) { char *s[4]={"abple","aaple","apple","acple"};// 迭 ڿ int i, j;// ݺ ϱ //char *s[4]; //ڿ Է¹޾ óϱ پ غ ʾ ڿ 迭 · ̿ϴ Ͽϴ //char s[4][100]; /*char **s; int...
C
/* : :2010.8 Զ̿ƱȺ:30660169,6467438 */ #include "file.h" char * file_read(char *path,unsigned long *length) { char * data; FILE *fp = fopen(path, "rb"); if (fp == NULL) return NULL; fseek(fp, 0, 2); *length = ftell(fp); fseek(fp, 0, 0); data = malloc(*length); if (data == NULL){...
C
#include <stdio.h> #include <stdlib.h> typedef struct node{ int value; struct node *next; }NodeT; typedef struct stack{ int nr; NodeT *top; NodeT *bottom; }StackT; NodeT *createNode(int value){ NodeT *node = (NodeT*)malloc(sizeof(NodeT)); if (node == NULL){ printf("ERROR: NODE WAS...
C
// // main.c // Lista Doblemente Enlazada // // Created by Francisco Árciga Nolasco on 7/11/18. // Copyright © 2018 Francisco Árciga Nolasco. All rights reserved. // #include <stdio.h> #include <stdlib.h> typedef struct Lista Lista; struct Lista{ int dato; struct Lista * siguiente; struct Lista * anter...
C
/* * dsp.h * Static * * Created by Curtis Jones on 2009.12.30. * Copyright 2009 Curtis Jones. All rights reserved. * */ #ifndef __DSP_H__ #define __DSP_H__ #include <stdint.h> #include "../misc/mem/cobject.h" #include "../misc/mem/opool.h" struct device; // // dsp_state // typedef enum { DSP_STATE_ENABL...
C
#include <stdint.h> #include <string.h> #include <stdio.h> #ifndef Flare_ZZTHaloGametype_h #define Flare_ZZTHaloGametype_h typedef uint16_t unichar; typedef struct HaloVehicleSpawn { unsigned int type : 4; unsigned int warthogs : 3; unsigned int ghosts : 3; unsigned int scorpions : 3; unsigned in...
C
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #define BUFFERSIZE 30 struct llst { char *wrd; int cnt; struct llst *next; }; typedef struct llst node; typedef node* link; link createNode(char *); link append(link, link); int searchNode(link, char *)...
C
#include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> int main() { int t; int flag = -1; int height = 1; scanf("%d",&t); int arr[t],i,cycles; for(i=0;i<t;i++){ scanf("%d",&arr[i]); } for(i=0;i<t;i++){ cycles = arr[i]; if(cycles==0){ ...
C
#include <stdio.h> #define BIN_SIZE 32 /* * based on udemy bitwise operators course; extended (dramatically) to support negative * decimal numbers * */ void convert_binary_and_print (int decNum, int binaryNum[]); void print_dec_to_bin (int decNum) { // array to store binary number if (decNum >= 0) { int b...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* remove_quoting_chars.c :+: :+: :+: ...
C
/* Пробелы после запятых Когда используются знаки препинания, например запятые, то нужно всегда ставить пробел после знака препинания и не ставить пробела до знака препинания. int a, b, c; ^ ^ | | запятая и пробел printf("%i %i\n", a, b); ...
C
/* ============================================================================ Name : Cifra Enigma Machine Author : Leandro Alves - 10/0110304 Version : 1.0 Copyright : CC Description : Criptografia ============================================================================ */ #include <std...
C
/* * File: pager-lru.c * Author: Andy Sayler * http://www.andysayler.com * Adopted From: Dr. Alva Couch * http://www.cs.tufts.edu/~couch/ * * Project: CSCI 3753 Programming Assignment 4 * Create Date: Unknown * Modify Date: 2012/04/03 * Description: * This file contains an ...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <errno.h> #include <unistd.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <sys/ioctl.h> #include <fcntl.h> #include "hi_gpio.h" int main(int argc, char *argv[]) { #if 1 gpio...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> #include "matrix.h" struct matrix create_matrix(int *data, int n_rows, int n_cols){ struct matrix link; link.data = data; link.n_rows = n_rows; link.n_cols = n_cols; link.stride_rows = n_cols; link.stride_cols = 1; link.offset = 0...
C
#include "scrabble_score.h" #include <ctype.h> static unsigned int score_book[] = { 1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 1, 1, 3, 10, 1, 1, 1, 1, 4, 4, 8, 4, 10 }; unsigned int score(const char *word) { char c; unsigned int word_score = 0; while ((c = tolower(*word++)...
C
#include <stdio.h> #include <stdlib.h> #include "selectionsort.h" void selectionsort(int *vetor, int n) { int i, iteracao, aux, menor, indice_menor; for(iteracao = 0; iteracao < n-1; iteracao++) { menor = vetor[iteracao]; indice_menor = iteracao; for(i = iteracao+1; i < n; i++) ...
C
#include<stdio.h> #include<conio.h> void main() { int start , end , diff ,num ; printf("Starting element of list : "); scanf("%d",&start); printf("Ending element of List : "); scanf("%d",&end); printf("Difference between two elements : "); scanf("%d",&diff); printf("Li...
C
#include <limits.h> int mx_gcd(int a, int b); int mx_lcm(int a, int b) { int lcm; if (a < 0) a *= -1; if (b < 0) b*= -1; lcm = (a / mx_gcd(a, b)) * b; if (lcm < INT_MAX) return lcm; else return 0; }
C
/* * Copyright (c) 2012-2013, chunquedong * * This file is part of fancpp project * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE version 3.0 * * History: * 2013-1-20 Jed Young Creation */ #include <stdio.h> #include "cfan/cfan.h" CF_BEGIN void cf_QueueTest_test(void) { cf_Queue queue; int a =...
C
#include<stdio.h> #include<string.h> #include<stdlib.h> #include<ctype.h> /* Isupper */ /* Defines */ #define MAX_NAME_SIZE 40 #define MAX_TEAM_NATIONALITY_NAME 4 #define ARRAY_SIZE 790 #define INPUT_FILE "cykelloeb" #define OTL -1 #define DNF -2 /* Structs */ struct cycleRace { char raceName[MAX_NAME_SIZE]; ...
C
/* Michael Hanna, mwhanna * CS 152, Spring 2017 * Project 2 */ #include <stdlib.h> #include <stdio.h> #include "players.h" /*returns the first valid move for a given turn*/ pos first_move(game* g, strategy_config unused){ unsigned i, j; pos p; for(i = 0; i < g->b->nrows; i++){ for(j = 0; j < ...
C
#include <asm/unistd.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <errno.h> #include <sys/syscall.h> #include <unistd.h> #include <openssl/md5.h> #include "common.h" #ifndef __NR_xcrypt #error xcrypt system call not defined #endif /* Fxn converts the passphrase provided by user into MD5 Hash...