language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include<stdio.h> #include<math.h> void main() { int n,dn,r,i=0; printf("Enter the binary number to be converted"); scanf("%d",&n); while(n!=0) { r=n%10; n/=10; dn+=r*pow(2,i); i++; } printf("The converted decimal form is\t%d",dn); }
C
#ifndef __TIMER__ #define __TIMER__ #include <time.h> #include <stdio.h> #define TIMER_INIT()\ struct timespec begin, end;\ uint64_t dura;\ #define TIMER_UP()\ clock_gettime(CLOCK_REALTIME, &begin);\ #define TIMER_DOWN()\ clock_gettime(CLOCK_REALTIME, &end);\ dura = ((ui...
C
#include <stdio.h> int main(){ char usuario[10]; //usuario char uTest[10]; //para validacin de usuario char caracter1, cTest; //character de la contrasea int numero, nTest; //entero de la contrasea int op; //para seleccionar opciones char op2; //para seleccionar opciones char *ap_caracter=&caracter1; int...
C
#include <stdio.h> // ヘッダファイルをインクルード int main() { const char arr[] = "Hello C11."; printf("Hello C.\n"); // 標準出力(ディスプレイ)に表示 printf("%s\n", arr); // 文字列リテラルは書式は%s return 0; }
C
#include "holberton.h" /** * _strlen - It takes one argument *@s: pointer on whose string lenght is to be found *Return: return len */ int _strlen(char *s) { int len; while (*(s + len)) { len++; } return (len); }
C
/* * irtim.c * * Created on: 26 Nov 2017 * Author: fabian */ #include "irtim.h" #include "avr/io.h" // Initialize IR LED timer. void irtim_init() { // Set Waveform Generation Mode to Fast PWM with TOP = OCR2A. TCCR2A = (1 << WGM21) | (1 << WGM20); TCCR2B = (1 << WGM22); // Set TOP value OCR2A = IRTI...
C
#pragma once #include <stdio.h> typedef enum _bool {FALSE, TRUE}bool_t; typedef struct _node { int data; struct _node* next; struct _node* prev; }node_t; typedef struct _list { node_t* head; node_t* tail; int size; }list_t;
C
#include "token.h" #include <ctype.h> #include <stdlib.h> #include <string.h> #include <stdio.h> int read_token (token *theToken, FILE *theFile) { char *p; char *s; char *first; char *second; char args[MAX_TOKEN_LENGTH]; char arg[MAX_TOKEN_LENGTH]; int i, x, y; int label; char* firstarg; char* sec...
C
/* Copyright (c) 2011-2012 Hiroshi Tsubokawa See LICENSE and README */ #include "Shader.h" #include "Vector.h" #include "Numeric.h" #include <stdlib.h> #include <string.h> #include <stdio.h> #include <float.h> struct VolumeShader { float diffuse[3]; }; static void *MyNew(void); static void MyFree(void *self); stat...
C
/* ** EPITECH PROJECT, 2018 ** my_rpg_2017 ** File description: ** seek_zone */ #include "map_editor.h" int seek_zone_horizontaly(my_w_t *window, char *zone_name) { for (; ZONE_COOR_X != ZONE_TAB_X; ZONE_COOR_X++) { if (ZONE_NAME && !my_strcmp(zone_name, ZONE_NAME)) return (1); } return (0); } int seek_zone(...
C
/********************************************************************/ /* */ /* Michael Botkin */ /* */ /* File Name : client.c */ /* */ /* Description : Function set for the */ /* */ /* Date created : 4/16/2014 ...
C
#include "Queues.h" /* Very simple queue * These are FIFO queues which discard the new data when full. * * Queue is empty when in == out. * If in != out, then * - items are placed into in before incrementing in * - items are removed from out before incrementing out * Queue is full when in == (out-1 + QUEUE_...
C
#include "ArrayEmployees.h" int initEmployees(sEmployee *list, int len){ int i; int ret=-1; if(list!=NULL){ for(i=0;i<len;i++){ if(list[i].isEmpty!=1){ list[i].isEmpty=1; } } if(i==len) ret=0; } return r...
C
#include<stdio.h> int elements(int arr[],int len) { int counted[len],j,n,count,flag; counted[0]=arr[0]; count=1; for(j=0;j<=len-1;j++) { flag=1; for(n=0;n<count;n++) { if(arr[j]==counted[n]) { flag=0; } ...
C
/* ************************************************************************** */ /* */ /* :::::::: */ /* get_next_line_utils.c :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <string.h> #include "bittools.h" #include "filetools.h" void generate_unordered_ints(uint32_t amount, FILE* output_file) { rewind(output_file); uint32_t values[amount]; memset(values, 0, amount*sizeof(uint32_t)); for (int i = 0; i < amount; i++)...
C
#ifndef _H_SPOLL #define _H_SPOLL #include "socket.h" // // 定义操作的事件集结构 // event[INT_EVENT] -> event_t // struct event { void * ud; bool read; bool write; bool error; }; #define MAX_EVENT (64) typedef struct event event_t[MAX_EVENT]; #ifdef __linux__ typedef int poll_t; #e...
C
#include "quadrature.h" #include <math.h> static double integrate_recursive(func_t f, double a, double b, double area) { double mid = (a + b) / 2.0; double area_left = calc_area(f, a, mid); double area_right = calc_area(f, mid, b); double area_lr = area_left + area_right; if (fabs(area - area_lr) <= precision) ...
C
#include<stdio.h> #include<stdlib.h> long r(long, long); main(){ long a, b; long ans; printf("input the power of base and exponent (A^B) :\n"); scanf_s("%ld%ld", &a, &b); ans = r(a, b); printf("power(%ld,%ld)=%ld=", a,b,ans); for (int i = 1; i <= b; i++){ printf("%ld*", a); } printf("\b \n"); system("pause"...
C
#include <stdio.h> int main(){ int n, s = 0; scanf("%d", &n); for(int i = 1; i <= n; i++){ s += (i+1)*i/2; } printf("%d", s); return 0; }
C
#include<stdio.h> int main(){ int arr[100],min,size,pos,max,pos2; scanf("%d",&size); for(int i=0;i<size;i++){ scanf("%d",&arr[i]); } min=arr[0]; pos=1; max=arr[0]; pos2=1; for(int i=1;i<size;i++) { if(arr[i]<=min) { min=arr[i]; ...
C
#include <stdlib.h> #include <stdio.h> #include "warmup2.h" /* print_asterisk_letter * input: char letter - the letter to print out * output: nothing returned, just printed to the screen. * Given a character, print the corresponding upper-case letter of the * alphabet using asterisks. The letter can be anything f...
C
#include <stdio.h> #include <stdlib.h> #define max 10 void swap(int *a,int *b) { int c=*a; *a=*b; *b=c; } int heapify(int heap[],int n) { int i,c,root,temp; for (i = 1; i < n; i++) { c = i; do { root = (c - 1) / 2; if (heap[c]...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "lexer.h" #include <php.h> #define BUFFER_SIZE 4096 struct List* get_tokens(char* file_name) { // initialize list tokens struct List* list = malloc(sizeof(struct List)); memset(list, 0, sizeof(struct List)); struct List* curElement =...
C
/* Make a function substring() to extract a portion of a charcter string. subtring("character", 4, 3, result) extract 3 charters begining from charter 4, and put the result in array result*/ #include <stdio.h> #include <string.h> const char* substring( char string[], int start_at, int length, char result[] ) { ...
C
// RUN: %clang_cc1 %s -verify -fsyntax-only -pedantic // RUN: %clang_cc1 %s -verify -fsyntax-only -x c++ -pedantic // This file contains UTF-8; please do not fix! extern void \u00FCber(int); extern void \U000000FCber(int); // redeclaration, no warning #ifdef __cplusplus // expected-note@-2 + {{candidate function not...
C
#include <stdio.h> #include <stdlib.h> int main() { size_t nmemb = 10; size_t size = 0; int *tmp; tmp = (int *)calloc(nmemb, size); printf("Standart calloc return: %p\n", tmp); return 0; }
C
#include "vm/frame.h" #include "vm/swap.h" #include "vm/page.h" #include "lib/kernel/list.h" #include "userprog/pagedir.h" #include "threads/malloc.h" #include "threads/palloc.h" #include "threads/synch.h" #include "threads/thread.h" #include "threads/vaddr.h" #include <stdio.h> #define PAGE_EVICTION true #define PAG...
C
#include<stdio.h> int sum(int n) { int val = 0; if(n == 0) { return 0; } else { val += n + sum(n-1); } return val; } int main(int argc, char *argv[]) { int n = 10; printf("\nSum of natural numbers till %d is %d",n, sum(n)); return 0; ...
C
#include <stdio.h> #include <unistd.h> #include <stdlib.h> int read_int() { char buf[0x10]; fgets(buf, sizeof(buf), stdin); return atoi(buf); } void print_flag() { char buf[0x100]; FILE *f = fopen("flag.txt", "r"); fread(buf, sizeof(buf), 1, f); puts(buf); exit(0); } void menu() { ...
C
/* Beatrice Liang and Jenny Lin */ /* Spring 2015 */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include "graphics.h" #define USECPP 0 /////////////////////////////////////////// /////////////////////////////////////////// //////////////////Image//////////////////// ////////////////...
C
/** * 循环队列的顺序表示和实现(头文件) * 当队列用顺序存储时,容易造成空间的浪费;而用链式存储时,会设计到申请释放空间,操作不便。因此让二者折中所以就出现了循环队列 * 循环队列在设计上依旧采用数组,而在逻辑上用链表 */ #ifndef CYLSQQUEUE_H #define CYLSQQUEUE_H #include "stdio.h" #include "stdlib.h" #include "../../Unit_1/src/myDefine.c" //银行模拟业务,习题hw_3_33.c中中需要重新定义ElemType #if (!defined BANK_SIMULATION_H) && (!d...
C
/** * @ brief ָĹϵ * @ author mculover666 * @ date 20197115:03:46 * @ encoding GBK/GHB2312 */ #include <stdio.h> #include <stdlib.h> int main(void) { int a[5] = {1,2,3,4,5}; int i; int* p = a; //ӡÿԪصĵַ for(i = 0;i < 5;i++) { printf("a[%d] = %#X\n",i, &a[i]); } ...
C
#include <stdio.h> #include <signal.h> #include <unistd.h> void my_handler(int signal, siginfo_t* si, void* ignore) { if(signal == SIGUSR1) printf("SIGUSR1 from %d\n", si->si_pid); else printf("SIGUSR2 from %d\n", si->si_pid); } int main() { struct sigaction act; act.sa_sigaction = my_...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* main.c :+: :+: :+: ...
C
/* Programmer: Beth Hanson Class: CptS 121, Summer 2018 Programming Assignment: Programming Assignment 1 Date: 06/08/18 Description: Physics Calculator*/ #pragma warning(disable : 4996) #include <stdio.h> #include <math.h> #define PI 3.14159 #define G 6.67E-11 int main() { double mass, acceleration, force; double ra...
C
//#include "test.h" // //double distance(double x1, double y1, double x2, double y2) //{ // return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)); //} //int main() //{ // double x1 = 0; // double x2 = 0; // double y1 = 0; // double y2 = 0; // printf("һ꣺-->"); // scanf("%lf%lf", &x1, &y1); // printf("<%lf%%lf>\n", ...
C
/** ****************************************************************************** * @file lab4_filter.c * @author Group 6 * @version V1.0.0 * @date 1-November-2013 * @brief This defines public functions for a simple Linear Moving Average Filter: * - Insert value into buffer * ...
C
// creating and using functions #include<stdio.h> #include<stdlib.h> int gcd(int x , int y); int main() { return 0; } int gcd(int x , int y) { int temp; temp=0; while(y!=0) { temp=x%y; x=y; y=temp; } return x; }
C
#include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <unistd.h> int main() { int ret; // become root ret = setuid(0); if (ret == -1) { printf("setuid root error\n"); return -1; } // kill planelogger.py printf("Killing planelogger.py\n"); ret = system("/usr/bin/pkill -f planelogger.p...
C
/* ** EPITECH PROJECT, 2018 ** ** File description: ** */ #include <stdio.h> #include <stdlib.h> #include <string.h> #define ptr_space 32 #define return_p printf char *my_strdup(char *ptr_str, int ptr_len){ for(int i = 0; i < ptr_len && ptr_str != '\0'; i++) if(ptr_str[i] != ptr_space) ret...
C
#include <stdio.h> void main() { int i,j; for (i = 0; i < 6; i++) { for (j = 6 ; j > i ; j--) { printf("*"); } printf("\n"); } }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* map.c :+: :+: :+: ...
C
/* Parikh Shivam ICSI 402 Assignment 4 UNIX ID: sp191221 */ #include <stdio.h> #include <ctype.h> #include <stdlib.h> #include <string.h> #include "constants.h" #include "struct.h" #include "externs.h" #include "prototypes.h" //////////////////////////////////////////// SYMBOL TABLE MAKING AND PRINTING STA...
C
/************************************ *图的邻接矩阵存储表示 ************************************/ #define INFINITY INI_MAx #define MAX_VERTEX_NUM 20 //最大顶点个数 typedef enum {DG, DN,UDG, UDN} GraphKind; //{有向图,有向网,无向图,无向网} typedef struct ArcCell { VRType adj; //VRType是顶点的关系类型。对无权图,用1和0表示相邻否;对带权图,则为权值类型 InfoType *info;...
C
#ifndef __LIST_H_ #define __LIST_H_ typedef struct node { int value; struct node *next; } Node; typedef struct { Node *first; Node *last; int length; } List; Node *create_node(int value); void insert_node(List *list, int value); List *create_list(void); int search_position(List *list, int value); void disp...
C
#include "libmy.h" void my_cd(char *pwd, char *arg) { char *tmp; } void my_cat(char *cmd) { int fd; char **table; char *line; int n = 1; int e = 0; table = my_str_to_wordtab(cmd); while (table[n]) { if (!my_strcmp("-e", table[n])) e = 1; n++; } n = 1; while (table[n]) { ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> void sort(int *a, int left, int right) { if (left >= right) { return; } int i = left; int j = right; int key = a[left]; int tmp = 0; while (i < j) { while (i < j && key <= a[j]) { j--; } ...
C
#include <stdio.h> #include <stdlib.h> struct node { int q; struct node *next; }; typedef struct node* Node; struct list { Node head; int size; }; typedef struct list* List; List init() { List l = (List)malloc(sizeof(struct list)); l->head = NULL; l->size = 0; return l; } void printList(List l) { Node te...
C
#include<stdio.h> #include<unistd.h> void main() { pid_t pid; pid=fork(); if(pid == -1) { printf("Child creation failed\n"); } else if(pid == 0) { printf("This is the parent\n"); } else { printf("This is the child with process id = %d\n",pid); } }
C
/******************************************************************************/ /*! \file motor_control.cpp \author Kenyu Tatsuta \par email: k.tatsuta\@digipen.edu \par DigiPen login: k.tatsuta \par Course: ECE360 \par 3rd Year Project \brief This is the implementation file for all member functions ...
C
#include "Driver.h" /// <summary> /// Gets the driver object. /// </summary> /// <param name="DriverName">Name of the driver.</param> PDRIVER_OBJECT GetDriverObject(const PUNICODE_STRING DriverName) { PDRIVER_OBJECT DriverObject; if (NT_SUCCESS(ObReferenceObjectByName(DriverName, OBJ_CASE_INSENSITIVE, NULL, 0...
C
#include <stdio.h> #include <fcntl.h> #include <string.h> #include <sys/socket.h> #include <sys/types.h> #include <netinet/in.h> #include <time.h> #include <pthread.h> #include <assert.h> #define SERVER_PORT (3000) #define LISTENNQ (5) #define MAXLINE (100000) #define MAXTHREAD (200) struct extension ...
C
#include "headers/graph_undirected.h" typedef struct query { int initial; int final; } query; int main() { // citire FILE *fin = fopen("drumuri.in", "r"); FILE *fout = fopen("drumuri.out", "w"); if (fin == NULL || fout == NULL) { printf("Nu exista fisierul!\n"); ...
C
#ifndef __TYPES_H__ #define __TYPES_H__ typedef unsigned char uint8_t; typedef unsigned short uint16_t; typedef unsigned int uint32_t; typedef unsigned long long int uint64_t; typedef signed char int8_t; typedef signed short int16_t; typedef signed int int32_t; typedef signed long long int int64_t; typedef uns...
C
#include <stdio.h> int main(void) { char inseln[][10] = { "Bermudas", "Fidschi", "Komoren", "Kuba"}; int y = 0; int ref = 0; int index[] = { 1, 3, 0, 2 }; while (y < 4) { ref = index[y]; printf("Insel: "); printf("%s\n", inseln[ref]); y = y + 1; } system("PAUSE"); return 0; }
C
#include "../lib/config.h" #include "../lib/heap.h" #include "../lib/logger.h" #include "../lib/registry.h" #include "../lib/runner.h" #include "../lib/sqlite.h" #include "../lib/vfs.h" TEST_MODULE(registry); #define FIXTURE \ FIXTURE_LOGGER; \ FIXTURE_VFS; \ FIXTURE_CONFIG; \ FIXTURE_REGISTRY; #defin...
C
#include <assert.h> #include <stdlib.h> #include <stdio.h> #include <string.h> #include <unistd.h> #include "UserList.h" // // Initialize a linked list // void llist_init(LinkedList * list) { list->head = NULL; } // // It prints the elements in the list in the form: // 4, 6, 2, 3, 8,7 // void llist_print(LinkedList ...
C
/************************************************************************ * Author: Mitchell Orsucci * * This software is offered freely by Digilent Inc. * * Creation Date: July 24, 2017 * * To be used in tandem with a UIO driver and the Xilinx AXI GPIO * that has been implemented on an FPGA * * Use at your own risk...
C
# include<stdio.h> # include<string.h> // global value and local value // local value include in the sub-routine will decide local value // int global = 2019; // int main() // { // int local = 2018; // int global = 2020; // printf("global = %d\n" , global); // return 0; // } // // constant value ...
C
/* OTHELLO -- The Game of Dramatic Reversals written by Bert Halstead modified for BDS C by Leor Zolman This program is a good example of: a) structured, heirarchical function organization b) arrays as formal parameters c) use of the "qsort" library function Object of the game is for two pl...
C
#ifndef LIST_H_ #define LIST_H_ typedef struct strList * List; typedef void * Type; typedef enum {False, True}bool; List list_create(void(*destructor)(void*)); void list_destroy(List); int list_size(List); void list_add(List, Type); Type list_getdata(List, int p); void list_set(List, Type, int p);...
C
#include<stdio.h> void main() { float a, b, c, d, e, f, g, result; printf("\n Enter the 7 values: "); scanf("%f%f%f%f%f%f%f", &a, &b, &c, &d, &e, &f, &g); result = ((a -b / c * d + e) * (f +g)); printf("\n ((a -b / c * d + e) * (f +g)) = %.2f \n", result); }
C
#include <stdio.h> int main() { int a[2][3]={{1,2,3},{4,5,6}}; int b[3][2]={{1,2},{3,4},{5,6}}; int c[2][2]={0}; int i,j,n; for(i=0;i<2;i++) { for(j=0;j<2;j++) { for(n=0;n<3;n++) { c[i][j]+=a[i][n]*b[n][j]; } } } for(i=0;i<2;i++) { for(j=0;j<2;j++) { printf("(AB)[%d][%d]=%d\n",i,j,c...
C
// From : http://stackoverflow.com/questions/13124271/driving-beaglebone-gpio-through-dev-mem // // Read one gpio pin and write it out to another using mmap. // Be sure to set -O3 when compiling. // Modified by Mark A. Yoder 26-Sept-2013 #include <stdio.h> #include <stdlib.h> #include <sys/mman.h> #include <sys/stat.h...
C
#pragma once #include "Repo.h" #include "OperationStack.h" typedef struct { MaterialRepo* repo; MaterialRepo* repo2; OperationStack* undoStack; } Controller; Controller* createController(MaterialRepo* r, MaterialRepo* aux, OperationStack* undoS); /* Adds a material to the repository. c-> pointer to controller name...
C
#include<stdio.h> #include<float.h> main(){ printf("Numéro más grande positivo: %e\n", DBL_MAX); }
C
#include "Controller.h" #include <stdlib.h> #include <string.h> Controller* createController(MaterialRepo* r, OperationStack* undoS){ Controller* c = (Controller*)malloc(sizeof(Controller)); c->repo = r; c->undoStack = undoS; return c; } void destroyController(Controller* c) { destroyRepo(c->repo); destroyO...
C
#include "initTeensy.h" #include <avr/io.h> void initTimers(void) { //Initializing Timer 1 to run with prescaler FCPU/8 //and counting to 2500 (Gives interrupt interval of 800Hz) TCCR1B = (1<<WGM12) | (1<<CS11); OCR1AH = 0x09; OCR1AL = 0xC4; TIMSK1 = (1<<OCIE1A); } void initPorts(void) { /...
C
#include <stdio.h> #include <time.h> /** * Gibt 5 Zufallszahlen aus, mit 5 verschiedenen Seeds. Zu jeder dieser Zahl * werden 20 Nachfolger ausgedruckt * Diese Nachfolger, koennen dann zum Knacken des Casinos genutzt werden. */ int main() { time_t timer; time(&timer); for(int i = 0;i<5;i++){ srand(...
C
#include<stdio.h> #include<string.h> int main(){ printf("strlen = %d\n", strlen("\0")); printf("sizeof = %d\n", sizeof("\0")); printf("sizeof = %d\n", sizeof("a\0")); printf("sizeof = %d\n", sizeof("aa\0")); return 0; }
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> #include <sys/types.h> #include <sys/stat.h> #include <time.h> #include <errno.h> #include <string.h> int main(int argc, char *argv[]) { size_t len = strlen(argv[0]); char *c; if (!(c = (char *)malloc(len + 3))) return -1; strcpy(c, ...
C
/* 003.c COPYRIGHT FUJITSU LIMITED 2015 */ #include "test_mck.h" #include "testsuite.h" #include <sched.h> #define MCK_RETURN_SEC 0 #define MCK_RETURN_NSEC 0 SETUP_EMPTY(TEST_SUITE, TEST_NUMBER) RUN_FUNC(TEST_SUITE, TEST_NUMBER) { pid_t pid = getpid(); int status = 0; struct sched_param set_param = { 0 }; struct...
C
#include <stdio.h> int main() { int a,r=0,b; printf("\n"); scanf("%d",&a); b=a; while(b!=0) { r=r*10; r=r+b%10; b=b/10; } if(a==r) printf("yes\n"); else printf("no\n"); return 0; }
C
#include "aokbase.h" static RGB svmod(RGB rgb, float s, float v) { HSV hsv; if(s == 1.0 && v == 1.0) return rgb; hsv = Rgb2Hsv(rgb); hsv.s *= s; hsv.v *= v; if(hsv.s > 1.0) hsv.s = 1.0; if(hsv.v > 1.0) hsv.v = 1.0; rgb = Hsv2Rgb(hsv); return rgb; } void writeCube(uchar *buf, int stride, float s, float v) {...
C
#include <string.h> #include <stdio.h> #include <stdlib.h> #include <sys/stat.h> int main(int argc, char* argv[]){ if(argc <= 2){ printf("wis-tar: tar-file file [...]\n"); exit(1); } else{ FILE *target; FILE *source; char fileName[100]; target = fop...
C
#include "main.h" #include <string.h> double GyrationRadiusSquare(double r[numUnit][DIM]) { double rCM[DIM]; memset(rCM, 0, sizeof(rCM[0])*DIM); for (int i = 0; i < numUnit; ++i) { for (int j = 0; j < DIM; ++j) { rCM[j] += r[i][j]; } } for (int i = 0; i < DIM; ++i) { rCM[i] = rCM[i] / numUnit;...
C
#include <stdio.h> void swap(int *x, int *y) { int temp = *x; *x =*y; *y = temp; } void sort(int arr[], int n) { int i, j, min; for(i = 0; i < n; i++) { min = i; for(j = i+1; j < n; j++) { if(arr[j] < arr[min]) { min = j; } } swap(&arr[min], &arr[i]); } } void print(int arr[], int n)...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> /* read a block of data into datablock */ int read_block(FILE *input, int nbits, float *block, int nread) { int i, j, k, s1, s2, s3, s4, iread; unsigned char *charblock; unsigned char *shortblock; long seed = 0; /* decide how to read the data based on the...
C
#include "stm32f4xx.h" // GPIO A PORTU 5. PIN = DAHILI LED // GPIO C PORTU 13. PIN = DAHILI BUTON uint8_t button_input = 0; uint16_t counter = 0; void GPIO_Config() { GPIO_InitTypeDef GPIO_InitStructure; RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE); RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_G...
C
#ifndef SUM_H_INCLUDED #define SUM_H_INCLUDED int sum(int x,int y) { int res=x+y; return res; } #endif // SUM_H_INCLUDED
C
/* OOMatrix.h Mathematical framework for Oolite. Oolite Copyright (C) 2004-2007 Giles C Williams and contributors This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, o...
C
/******************************************************************************* ** ** Copyright (c) 2006-2010 ICT/CAS. ** All rights reserved. ** ** File name: mac_bits.h ** Description: Header file for bits operation. ** ** Current Version: 1.0 ** Author: Jiangtao.Dong (dongjiangtao@ict.ac.cn) **...
C
#define _CRT_SECURE_NO_WARNINGS 1 #include <stdio.h> #include <stdbool.h> #include <stdlib.h> typedef int ElemType; typedef struct LNode{ ElemType data; struct LNode* next; }LNode; void LinkList_headInsert(LNode* L); void LinkList_tailInsert(LNode* r); void LinkList_Free(LNode* L); void LinkList_show(LNode* L); ...
C
// #include"mystring.h" // int mystrcmp(char *s1, char *s2) // { // while( ( *s1 != '\0' && *s2 != '\0' ) && *s1 == *s2 ) // { // s1++; // s2++; // } // if(*s1 == *s2) // { // return 0; // strings are identical // } // else // { // return 1; // } // ...
C
#include<stdio.h> #include<string.h> const int MAX = 20; int s[1 << MAX]; int main() { int d, I; while(scanf("%d%d", &d, &I) == 2) { memset(s, 0, sizeof(s)); int k, n = (1 << d) - 1; for(int i = 0; i < I; i ++) { k = 1; for(;;) { s[k] = !s[k]; k = s[k] ?(k * 2) : (k * ...
C
#include <stdio.h> #include <stdlib.h> int main(){ int a,b,c, AB, ABC; scanf("%d%d%d", &a, &b, &c); AB = ((a+b+abs(a-b))/2); ABC = ((AB+c+abs(AB-c))/2); printf("%d eh o maior\n", ABC); return 0; }
C
// prime number: // 3= 1 3 =factors count=2 // 7= 1 7 --2 //5 = 1 5 --2 // 11= 1 11---2 #include<stdio.h> int main() { int i,n,fcount=0; //5 printf("Enter any number:"); //5 scanf("%d",&n); for(i=1;i<=n;i++)//6 6<=5(F) { if(n%i==0)// 5%5==0(F) { fcount=fcount+1;//0+1=1 1+1=2 } } if(fcount==2) //(2==2...
C
void InsertSort(int a[], int n) { int i, j; for (i = 1; i < n; i++) for (j = i - 1; j >= 0 && a[j] > a[j + 1]; j--) Swap(&a[j], &a[j + 1]); }
C
#include "argz.h" int main() { char *string = "SHELL=/bin/bash:usr=monty:PWD=/bin/monty:LANG=en_US.UTF-8"; /* char *before = "8"; char *with = "till"; */ char *argz; size_t argz_len; char *entry; /* for argz_next */ /* Test: argz_create_sep & argz_print */ argz_create_sep (string, ':', &argz, &argz_len); ...
C
#include "LinearSystem.h" static ulong canChange(const unsigned long line, const unsigned long column, const Matrix *matrix); static void trocarLinha(const ulong a, const ulong b, Matrix* matrix); static int transformarEmZero(const ulong line, const ulong pivotRow, /*const int column,*/ double k, Matrix* matrix); stat...
C
#include "StudentFixedSizeFieldFileHandler.h" void writeFixedStudentDataInFile(student_t student, FILE *filePointer) { fwrite(&student, sizeof(student_t), 1, filePointer); } student_t readFixedStudentDataInFile(FILE *filePointer) { student_t student; fread(&student, sizeof(student_t), 1, filePointer); ...
C
#include<stdio.h> int main() {for(int i=1;i<6;i++){ if(i==3) // continue; printf("%d\n",i); } }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* draw.c :+: :+: :+: ...
C
// cabealho da TAD vetor #define MAX 100 #define CAPACIDADE_INICIAL 8 #define VAZIO -1 typedef int tipo_dado; struct vetor{ int ocupacao; int capacidade; tipo_dado v[CAPACIDADE_INICIAL]; }; typedef struct vetor tipo_vetor; // retorna a ocupacao do vetor int obterOcupacao(tipo_vetor vetor); /...
C
#include <stdio.h> #include "function.h" void array_exchanger(int* array_a, int* array_b, int length) { int i; int temp; for (i=0; i<length; i++) { temp = array_a[i]; array_a[i] = array_b[i]; array_b[i] = temp; } }
C
#include "holberton.h" /** * ls_current_dir - a function displays current working directory * Return: returns the current working path */ char *ls_current_dir(void) { char *value; value = _getenv("PWD"); return (value); }
C
#ifndef BLETKA_UTILS_H #define BLETKA_UTILS_H /** * #################################################################### * UTILITIES FOR GENERAL PURPOSES * -------------------------------------------------------------------- * - provides methods to work with LED & speaker * #####################################...
C
#include<stdio.h> int main() { long long Sn=0,result=1; int i,n; scanf("%d",&n); for(i=1;i<=n;i++) { result*=i; Sn+=result; } printf("%lld",Sn); return 0; }
C
#include "trivium.h" // Trivium initialization function static void trivium_init(struct trivium_context *ctx) { memset(ctx, 0, sizeof(*ctx)); } // Function key and iv setup static void trivium_keysetup(struct trivium_context *ctx) { uint32_t w[10]; uint8_t s[40]; int i; memset(s, 0, sizeof(s)); for(i = 0; i <...