language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
/* picoc data type module. This manages a tree of data types and has facilities * for parsing data types. */ #include "interpreter.h" /* some basic types */ struct ValueType UberType; struct ValueType IntType; struct ValueType ShortType; struct ValueType CharType; struct ValueType LongType; struct ValueType Unsigne...
C
#include <stdio.h> int I; int perfecto(long); void imprime(long *); void main() { long PER[4], J = 6; int eval; for (I = 0; I < 4; I++) { eval = 0; while (eval == 0) { eval = perfecto(J); J++; } PER[I] = J-1; } printf("\nLos numer...
C
#include <stdio.h> #include <conio.h> void main() { int a,i,dem=0; printf("nhap so a\n"); scanf("%d",&a); if (a<2) { printf("a khong phai la so nguyen to\n"); } else if (a==2) { printf("a=2 la mot so nguyen to\n"); } else fo...
C
//--- Include Headers --------------------------------------------------------// #include "error_handling.h" #include "test.h" //--- External Functions -----------------------------------------------------// /** * @brief Returns value that multiplies the two parameters. * It has a multiplication table limit. ...
C
#include <stdio.h> #include <stdlib.h> #if !defined (_MSC_VER) #include <unistd.h> #else #pragma warning ( disable : 4244 ) #endif #include <string.h> #if defined (__MINGW32__) || defined (_MSC_VER) // Later versions of MSVC can handle %lld but some older // ones can only handle %I64d. Easiest to simply use // %I64d ...
C
/* Dynamically allocate memory for a string */ #include <stdio.h> #include <stdlib.h> #include <string.h> int main() { char * str = NULL; char enough; int limit; printf("You are going to enter a text\nBut before we need the limit to this text: "); scanf("%d", &limit); str = (char *) calloc(li...
C
/** * \file * * \brief Misc utility functions and definitions * * Copyright (C) 2009 Atmel Corporation. All rights reserved. * * \page License * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistrib...
C
#include <ctype.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <stdbool.h> /******************************************************************************* LINKED LIST /* @desc: structure to handle the list of commands * @params: key ...
C
// 6. Write a C program to read the value of an integer m and display the value of n is 1 when m is larger than 0, // 0 when m is 0 and -1 when m is less than 0. // Test Data: -5 // Expected Output: // The value of n = -1 #include <stdio.h> int main() { int m,n; printf("Enter the value of m: "); scanf("%d...
C
//http://www.patest.cn/contests/mooc-ds2015spring/03-树1 //题源:训练建树和遍历基本功 //题意:层次遍历输出叶子(list all the leaves in the order of top down, and left to right.) //方法:所给数据parent、child关系明确,不需要动态确定关系,静态链表存储更优。 // 队列实现层次遍历: // 1.Q.enque(root) // 2.while(!Q.empty) // r = Q.deque() // visited(r) // ...
C
#include<string.h> #include<stdio.h> int main() { char *p; int i; p=strchr("This is my string",'m'); printf("%s\n",p); char s[]="Is it not is so, why is like that is"; p=strtok(s,"is"); while(s!=NULL) { p=strtok(s,"is"); printf("%s\n",s); } }
C
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* Adopted from the public domain code in NaCl by djb. */ #include <string.h> #include <stdio.h> //#include "prt...
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 <iostream> #include <cstdio> #include <cstdlib> #include <cstring> #include <cctype> #include <stack> #include <queue> #include <deque> #include <map> #include <set> #include <vector> #include <cmath> #include <algorithm> #define lson l, m, rt<<1 #define rson m+1, r, rt<<1|1 using namespace std; typedef long l...
C
/** @file say_hello.c * Simple test application to read and write to the character device /dev/khello. Used for testing with the khello kernel module. * * Usage: * After loading the kernel module. * To read from the device: "./say_hello read" * To write to the device: ./say_hello write something" * */ #inclu...
C
#include <stdio.h> void f3(); int main(int argc, char const *argv[]) { void f2(); void f1(); int n = 8; f1(); f2(); return 0; } void f1() { printf("f1\n"); f3(4); } void f2() { //f3(3); printf("f2\n"); } void f3(int a){ printf("f3%d\n",a); }
C
struct dlnode { int info; struct dlnode *rlink; struct dlnode *llink; }; typedef struct dlnode *DLNODE; static int dlcount = 0; DLNODE head; void dldrawstring(float x, float y, char *string) { char *c; glRasterPos2f(x, y); for(c = string; *c != '\0'; c++) { glutBitmapCharacter(...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* region_manager.c :+: :+: :+: ...
C
#include <stdio.h> int main(void) { int a; printf("number? "); scanf("%d",&a); if (a==1) { printf("Sunday\n"); } else if (a==2) { printf("Monday\n"); } else if (a==3) { printf("Tuesday\n"); ...
C
//Libraries including #include <stdio.h> void main (){ //Printing information printf("I'm Amir Shetaia\n" "\nMy birthdate is 1 Oct 2001\n" "\nI Study at Faculty of Engineering\n" "\nMansoura University 2024\n" "\nMy E-mail is \"AShetaia@std.mans.edu.eg\""); }
C
#include<stdio.h> #include<stdlib.h> #define N 10 struct date { int year; int month; int day; }; struct appliance { char unitname[20]; char telephone[11]; }; struct food { struct date a; }; struct goods { char num[20]; char name[20]; struct date b; int money; int quantity; char ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* handle_left_just.c :+: :+: :+: ...
C
#ifndef _COMPASSCAL_LIB #define _COMPASSCAL_LIB #ifdef __cplusplus extern "C" { #endif /* standard calling convention under Win32 is __stdcall */ #if defined(_WIN32) #define COMPASSCAL_API __stdcall #else #define COMPASSCAL_API #endif /** * Progress report callback funtion. Most of these variables won't concern ...
C
#include<stdio.h> void main(){ int i,size=5,item,pos,a[10],j; printf("enter the elements: "); for(i=0;i<size;i++){ scanf("%d",&a[i]); } printf("enter the item to insert"); scanf("%d",&item); printf("enter the postion to insert"); scanf("%d",&pos); size++; for(j=size;j>=pos;j--){ a[j]=a[j-1]; } a[j]=ite...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <cjson/cJSON.h> #include <curl/curl.h> #include <dirent.h> #include <errno.h> #include "header.h" #include "functions.c" int main(int argc, char *argv[] ){ int count, i; count = 360; int numOfFiles, oldNum...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> #include <string.h> int main() { char answer[4] = {0}; char guess[4] = {0}; // make answer srand(time(NULL)); snprintf(answer, 4, "%03d", rand() % 1000); printf("answer: %s\n", answer); // guess printf("input: "); scanf("%03...
C
#include <stdio.h> int main () { int cont, inicial; unsigned long int nro; printf("Ingrese un numero entero positivo. Determinaremos su factorial.\n"); scanf("%d",&nro); while(nro<0){ printf("Ingrese un numero correcto.\n"); scanf("%d",&nro); } cont=nro, inicial=nro; con...
C
#include "holberton.h" /** * add - The primary function being carried out * @a: the first character in formula * @b: the second character in formula * Description: Parses 'a' and 'b' and returns 'val' * a blank line * Return: returns @val */ int add(int a, int b) { int val; val = (a + b); return (val); }
C
#include<stdio.h> #include<stdlib.h> #include<math.h> void sort(int *arr,int num) { int i,temp,j; for(i=0;i<num-1;i++) { for(j=i;j<num-1;j++) { if(arr[j]>arr[j+1]) { temp=arr[j]; ar...
C
#include<stdio.h> //#include<conio.h> struct data { int rollno; char name[20]; int age; int per; }; void create(struct data d[10], int i) { printf("\nStudent No.: %d\n",i+1); printf("Enter Roll No: "); scanf("%d",&d[i].rollno); printf("Enter Name: "); scanf("%s",d[i].name); printf("Enter Age: "); scanf("%d"...
C
/* * main.c * * Created on: Feb 6, 2014 * Author: gankit */ #include <stdio.h> #include <stdlib.h> #include <time.h> #define TEST #undef TEST #ifndef TEST #define NO_OF_MATRICES 15 #else #define NO_OF_MATRICES 3 #endif #define INF ~(1 << 31) #define ZERO 0 inline int min(int a, ...
C
// Name: Anthony Tracy // Note this is still psudocode, there is implimentation of C for most part, but still psudocode // This would be code found in a fucntion that the process would fork() // Let there be some shared data as shown below: MAX_THREAD=4; AT_BARRIER=0; /* This is some section of code that each ...
C
#include <greek.h> #include "normucase.proto.h" /* * convert from beta code capital letters * * greg crane * february 1987 */ /* * start with something like "*(/ellhn" * and end with "E(/llhn" */ normucase(char *word) { register char * s; register char * t; if( *word != BETA_UCASE_MARKER ) return(0); s ...
C
#ifndef SIGCHAIN_H #define SIGCHAIN_H /** * Code often wants to set a signal handler to clean up temporary files or * other work-in-progress when we die unexpectedly. For multiple pieces of * code to do this without conflicting, each piece of code must remember * the old value of the handler and restore it either ...
C
/*----------------------------------------------- SIZE.c - ------------------------------------------------*/ #include <stdlib.h> #include <string.h> #include "Common.h" #include "CoAPBlk.h" /** * Construct SIZE struct */ void NewBlock(CoAPBlk_t *blk, u8 bf, u8 blkn, u16 len) { blk->bf = bf; blk->blkn = blkn...
C
#include "time.h" static unsigned timer_ticks = 0; static time_handle handles[NUM_TIME_HANDLES]; static int handle_index = -1; void set_phase(unsigned hz) { unsigned divisor = 1193180 / hz; /* Calculate our divisor */ outb(0x43, 0x36); /* Set our command byte 0x36 */ outb(0x40, divis...
C
/* * sendMail.c * * Rafael dos Santos Alves (rafael2710@gmail.com) * Viviane de França Oliveira (viviane.oliveira123@gmail.com) * */ #include "network.h" #include "error.h" #include "const.h" #include "types.h" int main (int argc, char *argv[]) { int port=0; char server[MAXNAMESIZE]; char from[MAXNAMESIZE]; ...
C
#include<stdio.h> void main() { char str[81],*p=str,*q,t; gets(str); printf("The origenal string:\n"); puts(str); for(p=str;*(p+1);p++) for(q=p+1;*q;q++) if(*q<*p) { t=*p; *p=*q; *q=t; } printf("The result string:\n"); puts(str); }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* final.c :+: :+: :+: ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* main.c :+: :+: :+: ...
C
#ifndef _EVENT_H #define _EVENT_H /* Events are actually function pointers, and your event is expected to take ** one argument that is a pointer to the object to which the event occurs. */ typedef void *Object; typedef void (*Event)(Object); typedef double Time; typedef struct _eventStruct { Time time; Event...
C
/* ------------------------------------------------------------------------- * Project: sumoGeek * Author: Germán Sc. * Date: 18-08-17 * Version: 0.1 * * Description: * Biblioteca para el control de los motores. * ------------------------------------------------------------------------- */ #ifndef SRC...
C
#include<stdio.h> #include<stdlib.h> #define size 30 char s[size]; int top=-1; void push(char item) { if(top==size-1) printf("Overflow"); else s[++top]=item; } int is_operator(char item) { if(item=='*'||item=='/'||item=='+'||item=='-'||item=='^') return(1); else return(0); } int precedence(char item) { if(item=='^'...
C
#include <pebble.h> #include "log_menu_window.h" #include "old_entry_window.h" #include "model.h" Window *log_menu_window; // The window that houses it all static MenuLayer *log_menu_layer; // The layer that houses it all static WorkoutPeek *workouts; // The collection of workouts that we need to worry about to avoi...
C
// // main.c // P2676_超级书架 // // Created by 谢 on 2019/9/24. // Copyright © 2019 谢. All rights reserved. // #include <stdio.h> int ls[20005]; int main() { int n,b,i,j,val,sum=0,time = 0; scanf("%d%d",&n,&b); for (i=0; i<n; i++) { scanf("%d",&ls[i]); } for (i=0; i<n; i++) { for (j...
C
#include <stdio.h> #include <stdlib.h> #include "quick_sort.h" void print(int array[], int num) { for (int i = 0; i < num; ++i) { printf("%d\t", array[i]); } printf("\n"); } int main(int argc, char const *argv[]) { int a[] = {13,19,9,5,12,8,7,4,21,2,6,11}; print(a, 12); quick_sort(a, 0, 11); pri...
C
#include<avr/io.h> #include<avr/delay.h> #define PORT PORTD #define DDR DDRD int main(void) { DDR = 0xFF; PORT = 0x00; while(1) { for( int i =0 ; i<8 ; i++) PORT = (1<<i),_delay_ms(80); for( int i = 7 ; i>=0 ; i--) PORT = (1<<i), _delay_ms(80); } }
C
#include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <math.h> #include "gc_stack.h" #include "prim_int63.h" typedef value primfloat; typedef value primfloatintpair; typedef value primfloat_comparison; typedef value primfloat_class; #define trace(...) // printf(__VA_ARGS__) #define Double_block 1277 //...
C
#include <stdio.h> void display_float(double x) { int i; for (i=0; i<8; i++) { // 8 is sizeof(double) unsigned char c; c = ((char *)(&x))[i]; printf("%x-", c); } printf("\n"); } main() { double a = 800.0 ; double b = 0.75 ; double c = 0.6 ; printf("sizeof(double)=%d\n", sizeof(double)); printf("a=%f...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_s_conv.c :+: :+: :+: ...
C
#include <stdio.h> #include<stdlib.h> typedef struct node { int value; struct node *next; struct node *prev; } node; node *head=NULL; node *tail=NULL; int isEmpty() { if ((head==NULL)&&(tail==NULL)) return 1; else return 0; } int init(int value) { struct node *tmp; tmp = (struct node*)malloc(sizeof(struct node)); t...
C
#include <stdio.h> void main (void) { int contador; for (contador = 1; contador <=5; contador++) printf ("%d ", contador); printf ("\nIniciando o segundo laço\n"); for (contador = 1 ; contador <= 10; contador++) printf ("\nIniciando terceiro laço\n"); for (conta...
C
/* ============================================================================ Name : c.c Author : Priyadarshini Singh Solanki Version : Copyright : Your copyright notice Description : Hello World in C, Ansi-style ============================================================================ */...
C
/* Задача 11. Напишете функция void squeeze(char s[], int c), която премахва символа с от низа s[] */ #include <stdio.h> /* "abacd" .3 bcd */ void squeeze(char s[], int c) { int i = 0, j = 0; while (s[i] != '\0') { if (s[j] == c) j++; s[i] = s[j]; i++, j++; } } int main() { ...
C
#include <stdio.h> #include <stdlib.h> int main(int argc, char **argv) { FILE* inputFile = fopen("sample_text.txt", "r"); int c; while ((c = fgetc(inputFile)) != EOF) { putchar(c); } fclose(inputFile); exit(0); }
C
#include "stdio.h" #include "stdlib.h" #include "string.h" #include "unistd.h" #include "time.h" #include "MQTTClient.h" #define ADDRESS "211.67.16.19" #define CLIENTID "cpp-mqtt-0001" #define TOPIC "/python/mqtt" // QoS0,At most once,至多一次; // QoS1,At least once,至少一次; // QoS2,Exactly once,确保只有一次。 #define ...
C
/* * merge_array.c * * Entire merge sort. * * Created on: 2013/01/11 * Author: leo */ #include "sort.h" static int (*comp)(const void *, const void *); static size_t length; /* array_sort */ static void copy(void *dst, const void *src, size_t size) { #ifdef DEBUG qsort_moved++; #endif memcp...
C
#include <stdio.h> #include <stdlib.h> int fact(int val){ int res = 1; for(int i=val;i>0;i--){ res *= i; } return res; } float c(int n ,int r){ int t1, t2, t3; t1 = fact(n); t2 = fact(r); t3 = fact(n-r); return t1/(t2*t3); } float pascalTriangleC(int n ,int r){ if(r == 0 || n == r) return 1; else return pa...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* length_conversion1.c :+: :+: :+: ...
C
// Aldán Creo Mariño, SOII 2020/21 #include <stdlib.h> #include <stdio.h> #include <unistd.h> #include <string.h> #include <errno.h> #include <fcntl.h> #include <pthread.h> #include <math.h> double suma = 0; int T, M; #define FALSE 0 #define TRUE 1 #define N 2 int turno; int interesado[N]; void entrar_region(int pr...
C
#include <stdarg.h> #include <stdio.h> int f(void* junk1, char junk2, int n, ...) { va_list l; va_start(l, n); int ret = 0; for(int i = 0; i < n; ++i) { ret += va_arg(l, int); } va_end(l); return ret; } int main(int argc, char** argv) { return f(0, 2, 5, argc, argc, argc, argc, argc); }
C
#include "functions.h" int main(int argc, char *argv[]) { /* Controllo del corretto inserimento di argomenti a riga di comando */ if(argc!=2){ printf("\nNumero errato di argomenti, si prega di scrivere solo il nome dell'eseguibile seguito dal nome del file\n\n"); exit(-1); } FILE *fi...
C
#include "sensor.h" #include "motor.h" int main(void) { _delay_ms(3000); // 3초후 동작 int error_val; sensor_init(); // 포트C를 센서 입력으로 설정 motor1_init(); motor2_init(); while (1) { error_val = get_error(get_sensor()); // 에러값 저장 (-3 ~ +3) motor1_get_spd(error_val); motor2_get_spd(error_val); ...
C
#include<stdio.h> int main() { int a=023; // 0 before a number is octal int b=0x23; printf("octal 023 is %d in decimal\n",a); printf("hexadecimal 0x23 is %d in decimal\n",b); printf("Size of 23L is %d",sizeof(23L)); return 0; }
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> int n, s; int z[401][401]; int main() { scanf("%d %d", &n, &s); for (int i = 1, a, b; i <= s; i++) { scanf("%d %d", &a, &b); z[a][b] = -1; z[b][a] = 1; } for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { for (int k = 1; k <= n; k++) { if (z[j][i] && (z[j][i] == z[i][...
C
#include<stdio.h> #include<stdlib.h> int main() { int i,j,k,T,minx,minn,bus,b[1001],ch,cm,th[1001],tm[1001],tn[1001]; scanf("%d",&T); for(i=1;i<=T;i++) { scanf("%d %d:%d",&bus,&ch,&cm); for(j=0;j<bus;j++) { scanf("%d:%d %d",&th[j],&tm[j],&tn[j]); }...
C
/* ************************************************************************** */ /* */ /* :::::::: */ /* get_next_line.c :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> void selectionSort(int size, int arr[]) { int temp = 0, max = 0; for(int i = 1; i < size; i++) if(arr[i] > arr[max]) max = i; temp = arr[size - 1]; arr[size - 1] = arr[max]; arr[max] = temp; if(size != 2) ...
C
//Project 3B #include <functions.h> #include <fstream> #include <iostream> #include <stdio.h> #include <stdlib.h> using namespace std; //File read and write functions void ReadImage(char *filename, Image &output) { FILE *f_in; char magicNum[128]; int width, height, maxval; Pixel *aBuffer; f_i...
C
/* Maksymilian Mastalerz(0956502) mmastale@mail.uoguelph.ca */ #include <stdio.h> #include <stdlib.h> #include "HashTableAPI.h" #include "functions.h" /**Function for creating a node for the hash table. *@pre Node must be cast to void pointer before being added. *@post Node is valid and able to be added to the hash t...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> int *pi; void prefix(char *str, int ind) { int i, t = 0; pi[0] = 0; for (i = ind; i < strlen(str); i++) { //t = pi[t - 1]; while ((t > 0) && (str[t] != str[i])) t = pi[t - 1]; if (str[t] == str[i]) ...
C
#ifndef TYPES_H_ #define TYPES_H_ #include <stdio.h> #include <stdlib.h> #include <pthread.h> #include <commons/log.h> #include <commons/collections/queue.h> #include <commons/collections/list.h> #include <commons/string.h> #include <ensalada/validacion.h> #include <readline/readline.h> #include <readline/history.h> #i...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* read.c :+: :+: :+: ...
C
#include <stdio.h> #include <sys/socket.h> #include <stdlib.h> #include <netinet/in.h> #include <string.h> #include <unistd.h> #include <arpa/inet.h> #include <ctype.h> #include <limits.h> #include <errno.h> #define PORT 8080 void getCreds(int sock, char *buffer, char *cmd) { memset(buffer,0,2048); memset(cmd,...
C
#ifndef STUDENT_H #define STUDENT_H #include <stdio.h> #include <string.h> typedef struct Student{ int id; char name[40]; }Student; void printStudent(Student *s){ int c = 10; printf("Name of student: %s\n", s->name); printf("ID of student: %d\n", s->id); printf("Inside printStudent, c = %d...
C
Malloc = Memory Allocation #include <stdio.h> #include <stdlib.h> #include <math.h> #include <locale.h> int main(){ setlocale(LC_ALL, "Portuguese"); int* vetor = (int*) malloc(20); //Malloc alocação de bytes na memória, nesse caso, 20bytes if(vetor == NULL){ printf("Memória Insuficiente!\n"); } else{ printf...
C
static unsigned next_pow2(unsigned v) { #if defined(__GNUC__) && defined(__i386) if (v <= 2) return v; __asm__("bsrl %1, %0" : "=r" (v) : "r" (v-1)); return 2 << v; // smallest pow-of-2 >= v #else v--; // from bit twiddling hacks v |= v >> 1; v |= v >> 2; v |= v >> 4; v |= v >...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* term.c :+: :+: :+: ...
C
#include "main.h" /** * _strlen - to find the length of a string * @s: points to the string to check * Return: void */ int _strlen(char *s) { int i = 0; while (s[i]) i++; return (i); }
C
/* * ===================================================================================== * * Filename: offer-levelOrder.c * * Description: * * Version: 1.0 * Created: 2020/09/20 15时51分43秒 * Revision: none * Compiler: gcc * * Author: YOUR NAME (), * Or...
C
#include <stdlib.h> #include <stdio.h> #include "unsigned_int_operation.h" #include "utils.h" void test_equal_unsigned_int_add(unsigned int a, unsigned int b) { unsigned int add_true = a + b; bool * a_bits = num_to_bits((void *)&a); bool * b_bits = num_to_bits((void *)&b); bool * add_bits = (bool *)malloc(sizeof(...
C
#include <stdio.h> #include <stdlib.h> void swap1(int *a, int *b){ *a = *a + *b; *b = *a - *b; *a = *a - *b; } void swap2(int *a, int *b){ *a = *a ^ *b; *b = *a ^ *b; *a = *a ^ *b; } int main(){ int a = 13; int b = 7; printf("%d = a and %d = b\n", a, b); swap1(&a, &b); printf("%d = a and %d = ...
C
/* CS261- Assignment 1 - Q.2*/ /* Name: Matt Schreiber * Date: 10-12-2013 * Solution description: Passes three values to foo(), which manipulates * them in certain ways. Prints their initial * values to the console, and also prints their * ...
C
#include <stdio.h> int maze(char[8][8], int x, int y, int x2, int y2,int visited[8][8]); int main() { char a[8][8] = { {'x', ' ', ' ', ' ', ' ', ' ', ' ', ' '}, {'x', ' ', 'x', ' ', ' ', ' ', ' ', ' '}, {'x', ' ', 'x', ' ', ' ', ' ', ' ', ' '}, {'x', ' ', 'x', 'x', ...
C
#include <stdio.h> #include <stdlib.h> int main(int argc, char** argv) { unsigned n = 0, i, total; if (argc < 2) { scanf("%u", &n); } else { n = atoi(argv[1]); } total = 0; for (i = 1; i <= n; ++i) { total += i; #ifdef PRINT if (i % 5 == 0) { printf("%u\n", i); } #endif } ...
C
#include<stdio.h> struct student { int rollno; char name[20]; int percentage; }student; void main() { student rollno=1; strcpy(student.name,"tamil"); student.percentage=92; printf("rollno=%d",student.rollno); printf("name=%s",student.name); printf("percentage=%d",student.percentage); }
C
#include <linux/init.h> #include <linux/module.h> #include <linux/platform_device.h> #include <asm/io.h> unsigned long *gpc0_conf; unsigned long *gpc0_data; //2,ʵprobe int led_plat_drv_probe(struct platform_device * pdev ) { struct resource *addr_res1,*addr_res2; struct resource *irq_res; int irqno;...
C
#include "utils.h" #include "pool.h" Pool *create_pool(size_t item_size) { Pool *q = s_malloc(sizeof(Pool)); q->item_num = 0; q->item_size = item_size; q->max_item_num = 0x100; q->buf = s_malloc(q->max_item_num * q->item_size); q->cur = q->buf; q->free = delete_pool; return q; } void *...
C
/* 6 Dados o número n de alunos de uma turma de Introdução aos Autômatos a Pilha (MAC 414) e suas notas da primeira prova, determinar a maior e a menor nota obtidas por essa turma (Nota máxima = 100 e nota mínima = 0). */ #include <stdio.h> int main() { // Variaveis int NumAlunos, nota, maior, menor, i; ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct _carta { struct _carta *proximo; int valor; } CARTA; typedef CARTA *PTR_CARTA; typedef struct _baralho { PTR_CARTA topo; int tamanho; } BARALHO; typedef BARALHO *PTR_BARALHO; int esta_vazio(PTR_BARALHO baralho){ return ba...
C
#include <stdio.h> #include <string.h> char *ft_strncat(char *dest, char *src, int nb) { int i, j; j = strlen(dest); for (i = 0; i < nb; i++){ dest[j] = src[i]; j++; } dest[j] = '\0'; return dest; } int main () { char src[30] = "this is the source"; char dest[30] =...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_lstclear.c :+: :+: :+: ...
C
/** * acdat.c - Double-Array Trie implement * * @author James Yin <ywhjames@hotmail.com> */ #include "acdat.h" #include <alib/collections/list/segarray.h> #include <alib/object/list.h> /* Trie 内部接口,仅限 Double-Array Trie 使用 */ size_t trie_size(trie_t self); size_t trie_next_state_by_binary(trie_t self, size_t iNod...
C
/*#include<stdio.h> #include<string.h> int main() { //עѭڲѭʹõıĸҪһ int s,i,j=0,k=0,l=0,m=0,n=0,d,count=0,sum=0,p,q,coun,count1,count2,count3; char a[101]; int c[100]; scanf("%d\n",&s); for(q=0;q<s;q++) { k=0; count=0; count1=0; count2=0; count3=0; coun=0; scanf("%s",a); //¼ַ sum=strlen(a); while(a[k]!='\0'...
C
// // main.c // klm // // Created by Can KINCAL on 14.05.2015. // Copyright (c) 2015 Can KINCAL. All rights reserved. // #include <stdio.h> int main(int argc, const char * argv[]) { int dizi[10]={25,22,17,19,47,3,5,98,10,124}; int a; int gecici; scanf("%d",&a); for (int i=0;i<10;i++) f...
C
#include <stdlib.h> #include <stdio.h> #include <assert.h> #include <string.h> #include <unistd.h> #include <errno.h> #include <fcntl.h> #include "crawler.h" #include <pthread.h> #include <semaphore.h> /*void *Malloc(size_t size) { void *r = malloc(size); assert(r); return r; } char *Strdup(const char *s) { v...
C
#include "eeprom.h" void eeprom_write(uint8_t data,uint16_t addr ){ while(READBIT(EECR,1)); EEAR = addr; EEDR = data; SETBIT(EECR,2); SETBIT(EECR,1); } uint8_t eeprom_read(uint16_t addr ){ while(READBIT(EECR,1)); EEAR = addr; SETBIT(EECR,0); return EEDR; }
C
#include <stdio.h> #include <stdlib.h> #include <time.h> #include <unistd.h> FILE *fp; void init_csv() { fp = fopen("log.csv", "w+"); fprintf(fp, "Timestamp, TAG, WiringPi, Value\n"); } void write_csv(char *tag, int wiringPi, int value) { int hours, minutes, seconds, day, month, year; time_t now = ti...
C
#include <stdio.h> int main(void) { // declare nessasary variables int cityNum = 0; int cityPop[100]; // create scanf to find out number of cities scanf("%d", &cityNum); printf("Number of cities: %d", cityNum); // create scanfs to find out pop per city for(int i = 0; i < cityNum; i++) ...