language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
/* * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed...
C
#include <stdio.h> #include <sys/mman.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <stdlib.h> #include <string.h> #define TLB_SIZE 32 #define PAGES 256 #define PAGE_MASK 255 #define PAGE_SIZE 256 #define OFFSET_BITS 8 #define OFFSET_MASK 255 #define MEMORY_SIZE PAGES * PAGE_SIZE // Ma...
C
#include "strings.h" #include "garbage_collector.h" int strStringInit(string *str){ if ((str->str = (char*) gMalloc(sizeof(char) * STRING_ALLOC_SIZE)) == NULL){ return STRING_ERROR; } str->str[0] = '\0'; str->stringLength = 0; str->allocatedMemory = STRING_ALLOC_SIZE; return STRING_SUCCESS; } int strAddCharTo...
C
#include <stdio.h> void main(){ int a, b, pgcd, i; printf("entrer a et b : "); scanf("%d %d",&a,&b); i = 1; while(i<a && i<b){ if (!(a%i) && !(b%i)) pgcd = i; i++; } printf("le pgcd est %d",pgcd); }
C
/* * polymult.c Jim Piper @ I.R.S. 22-08-86 * * multiply vertex values of polygon by constant * * modifications: * * 08 May 1987 BDP protection against null or empty objs */ #include <stdio.h> #include <wstruct.h> /* * protection against null domain added. no action occurs in case of error. * bdp 8/5/87 ...
C
/** * Copyright © 2012 Canonical, Ltd. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, ...
C
#pragma once #include "d_error.h" enum { DIMG_COLOR_FORMAT_RGB = 3, DIMG_COLOR_FORMAT_RGBA = 4, DIMG_COLOR_FORMAT_RGB_FLOAT = 12, DIMG_COLOR_FORMAT_RGBA_FLOAT = 16 }; typedef struct _dimg { int color_format; int width; int height; int pitch; unsigned char* pixels; } DImg; typedef...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* check_for_room.c :+: :+: :+: ...
C
#include<stdio.h> void main() { int a[10],i,as=0; for(i=0;i<10;i++) { scanf("%d",&a[i]); } as=a[0]; for(i=0;i<10;i++) { if(as<a[i]) { as=a[i]; } } printf("%d",as); }
C
#ifndef ULIST_H_ #define ULIST_H_ #include <stdlib.h> #include <stdio.h> typedef unsigned int UINT; #define NELEM_PACKET 100 typedef struct _particle { float r[3]; float v[3]; float q; float m; UINT pushme; struct _particle *next; } Particle; typedef struct _ulist_packet { struct _ulist_packet ...
C
/*This is a comment*/ #include <stdio.h> int main() { int age; char x,y,z; float pi; age = 25; x = 'A'; y = 'B'; z = 'C'; pi = 22.00 / 7.0; printf("\nA sample C program\n\n \t Yes It is a tab.\n"); puts("Just trying babe"); printf("Passing a arguement %d\n", 4); printf...
C
#include <stdio.h> #include <avr/sleep.h> #include <avr/interrupt.h> #include "serial.h" extern int fib(int n); int main() { uint16_t inputs[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 23, 24, 0 }; uint8_t i; init_serial_stdio(); for(i = 0; inputs[i]; i++) { printf("%u -> %u\n", inp...
C
#include<stdio.h> int main() { int num, count = 0; printf("Enter any integer: "); scanf("%d", &num); while(num != 0){ num = num/10; ++count; } printf("Total Number of digits : %d\t", count); }
C
/* ** main.c for RSA in /home/ksa28/Kent/RSA/src ** ** Made by Kevin Almansa ** Login <ksa28> ** ** Started on Mon Jan 18 18:50:31 2016 Kevin Almansa ** Last update Mon Jan 18 22:47:16 2016 Kevin Almansa */ #include <stdio.h> #include <stdlib.h> #include <time.h> #include "rsa.h" #include "primes.h" int main(int...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* check_tetrimer.c :+: :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <inttypes.h> #include <pthread.h> #include <sys/stat.h> #include <sys/types.h> #include <unistd.h> #include "splitpoints.h" static void split(void *cookie, int fd, int num, uint64_t *split_offsets) { static pthread_mutex_t lock = PTHREAD_MUTEX_INITIAL...
C
#include "DUMBcli.h" int main(int argc, char** argv) { if(argc != 3) { /* Invalid number of arguments */ fprintf(stdout, "%s", USAGE); exit(EXIT_SUCCESS); } /* open socket and attempt to connect to server at most 3 times. * if connection fails, connect_to_server(...) will handle error-reporting * and shu...
C
#include "DirectCircleRepeatFinder.h" void getMiminizationVector(char* s1, char* s2, char* s3, unsigned long l, int* result) { if (l == 0) { result[0] = 0; result[1] = 0; result[2] = 0; return; } // get d(s1,s2) int* v1 = levenshtein(s1,s2,l,l); // get d(rev_s1, r...
C
#include <stdio.h> int threexplusone(int x) { if (x == 1) return (0); if (x % 2 == 0) { return (threexplusone(x / 2) + 1); } else { return (threexplusone(3 * x + 1) + 1); } } int main (void) { int i; printf("Solutions for 3x + 1, numbers 1-100\n"); for (i = 1; i <= 100; i++) { printf("%d: %d\n...
C
#include<stdio.h> #include<string.h> #include<dirent.h> #include<sys/stat.h> #include<stdlib.h> #include<unistd.h> #include<sys/types.h> #include<sys/wait.h> #include<errno.h> char *directory(char *path){ char *token; char *dir; size_t len; token = strrchr(path, '/'); // finds last occurence of c...
C
/************************************************************************* > File Name: 8.7.c > Author: > Mail: > Created Time: Mon 22 Feb 2016 10:37:16 PM EST ************************************************************************/ #include<stdio.h> #include<assert.h> char * sncat(char *str1, const char * st...
C
#include <stdio.h> #include <stdlib.h> #include <omp.h> #include "fileToMatrix.h" MDATA initializeMatrixData(int lines, int columns){ MDATA mData = (MDATA)malloc(sizeof(struct sMatrixData)); mData->matrix = NULL; mData->dataMatrix = NULL; mData->multiplicationVector=NULL; mData->multiplicationResult=NULL; mData-...
C
/* Write a program that reads in N non-negative integers from the user (one at a time) and show the maximum and minimum value */ #include <stdio.h> void main () { int n, i; unsigned int max=0, min=-1, num; printf ("\n How many numbers ? "); scanf ("%d", &n); printf ("\nEnter numbers - \n"); for (i=0; i<n; ...
C
/* * Host Dispatcher Shell Project for SOFE 3950U / CSCI 3020U: Operating Systems * * Copyright (C) 2015, <GROUP MEMBERS> * All rights reserved. * */ #ifndef UTILITY_H_ #define UTILITY_H_ #include "queue.h" // The amount of available memory #define MEMORY 1024 #define BUFFER_LEN 256 // Process structure that co...
C
#ifndef __KEYBOARD_H #define __KEYBOARD_H /** @file keyboard.h * @brief file containing declarations of the functions that deal with the keyboard */ /** @defgroup keyboard keyboard * @{ * * @brief functions for using the i8042 keyboard */ /**@{ * @brief Keyboard info */ typedef struct { long scan_code; /...
C
#include<stdio.h> #include<conio.h> int main() { int a,b,c; printf("enter any three number"); scanf("&d&d&d", &a,&b,&c); if(a>=b) { if(a>=c) printf(" greatest number is&d", a); else printf(" greatest number is&d", b); } else { if (b>=c) printf(" greatest number is&d", b); else printf(" greates...
C
#include <math.h> #include <stdint.h> #include <stdio.h> #include "pl_config.h" #include "common_hw.h" #include "chn2freq.h" #ifndef __GNUC__ static inline double pow10(double x) { return pow(10, x); } #endif /*********************** AD功率调节门限、DA功率调节门限 公式: thr = 10*log10(reg/2^24) => reg[23:0] = 10^(thr/10) * 2^24 ...
C
#include "ILI9341_STM32_Driver.h" #include "ILI9341_GFX.h" #include "5x5_font.h" #include "spi.h" #include "main.h" void ILI9341_Draw_Hollow_Circle(uint16_t X, uint16_t Y, uint16_t Radius, uint16_t Colour) { int x = Radius-1; int y = 0; int dx = 1; int dy = 1; int err = dx - (Radius << 1); whi...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* move_word.c :+: :+: :+: ...
C
#include "head.h" void main() { int i=0,len,*arr,*temp; printf("鳤:\n"); scanf("%d",&len); arr=(int*)malloc(sizeof(int)*len); temp=(int *)malloc(sizeof(int)*len); text(arr,len); printf("ԭΪ:\n"); for(i=0;i<len;i++) { printf("%d ",arr[i]); } printf("\nΪ:\n"); insertsort(...
C
#include <stdio.h> #include <string.h> int main () { char str1[50]; char str2[50]; printf("Masukkan String 1 : "); scanf(" %s", &str1); printf("Masukkan String 2 : "); scanf(" %s", &str2); puts(str1); // printf("String 1 after reverse is %s\n", strrev(str1)); printf("R...
C
/* ** my_fct_built.c for 42sh in /home/saursf/42/src ** ** Made by Florian Saurs ** Login <saursf@epitech.net> ** ** Started on Fri May 22 15:44:59 2015 Florian Saurs ** Last update Sun May 24 22:02:48 2015 guillaume wilmot */ #include "minishell.h" char *my_strcat(char *dest, char *src) { int i; int c; char...
C
#include "debug_helpers.h" /* void debugMathExpression(Context* context, MathExpression* math_expression); */ /* void debugMathFactor(Context* context, MathFactor* factor); */ void debugLog(Context* context, const char* format, ...) { if ( context->debug_mode == 0 ) return; char result[1024]; /* Declare a v...
C
void ft_putchar(char c); int ft_strcmp(char *s1, char *s2) { int i; i = 0; while (s1[i] || s2[i]) { if (s1[i] - s2[i]) return (s1[i] - s2[i]); i++; } return (0); } void sort(int ac, char **av) { int i; int j; char *tmp; i = 0; while (++i < ac) { j = i - 1; while (++j < ac) if (ft_strcmp(a...
C
#include <stdlib.h> #include <stdio.h> #include <errno.h> #include <signal.h> #include <sys/types.h> int main (int argc, char * argv[]) { int i,pid; for (i = 0; i < 10; ++i) { pid = fork(); if (pid) { wait(pid); continue; } else if (pid == 0) { printf("%d\n", getppid()); sl...
C
/* definition of new type matrix */ typedef struct { int n; int m; double* vals; } matrix; /* definition of the matrix API */ matrix* matrix_new(int, int); matrix* matrix_new_random(int, int, double, double); void matrix_print(matrix*); double matrix_get(int, int, matrix*); void matrix_set(int, ...
C
#include <stdio.h> int main(){ int i,n,p,j=0; for ( i = 1; i <= 100; i++) { scanf("%d",&n); if (n>j) { j=n; p=i; } } printf("%d\n%d\n",j,p); return 0; }
C
#include <stdio.h> #include <stdlib.h> int main() { int amt, n1 = 1, n2 = 1; printf("Fibonacci numbers as you want to see: "); scanf("%d", &amt); if(amt == 1) { printf("%d", n1); } else { printf("%d %d ", n1, n2); int n3; for(int i = 3; i <= amt; ++i) ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include <errno.h> #include <sys/socket.h> #include <arpa/inet.h> #include <netinet/in.h> #include <unistd.h> #include <netdb.h> #define NTP_TIMESTAMP_DELTA 2208988800ull #define PORT 123 #define BRT -3 typedef struct { uint8_t li_vn_mo...
C
/************************************************************** * This class has been developed with main pupose of packing * * chunks of 8bits to a single unsgigned int variable. * * Develeped by Santiago De La Torre Pinzon * * at the University of Massachusetts at Amherst. * ...
C
/* ** free.c for in /home/athoma_j/rendu/new_malloc ** ** Made by julien athomas ** Login <athoma_j@epitech.net> ** ** Started on Tue Feb 10 21:40:05 2015 julien athomas ** Last update Sun Feb 15 22:17:49 2015 julien athomas */ #include "header.h" void merge_block(t_block *old_block) { old_block->size += old...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* resolution.c :+: :+: :+: ...
C
#include <stdio.h> #include <string.h> #include <openssl/evp.h> int main(int argc, char *argv[]){ int i; char text[] = "Text pro hash."; char hashFunction[] = "sha1"; // zvolena hashovaci funkce ("sha1", "md5" ...) EVP_MD_CTX ctx; // struktura kontextu const EVP_MD *type; // typ pouzite hashovaci funk...
C
/* ** EPITECH PROJECT, 2021 ** GALAXY ** File description: ** attack_3 */ #include "my_rpg.h" sfVector2f generate_point_on_circle(st_global *ad, float radius, float value, sfVector2f pos) { float angle = 0; float x = 0; float y = 0; angle = value * M_PI * 2; x = cos(angle) * radius + pos.x; y...
C
#include <sys/socket.h> #include <sys/un.h> #include <stdio.h> #include <string.h> #include <errno.h> #include <stdlib.h> #include <sys/types.h> #include <sys/uio.h> #include <unistd.h> #include <pthread.h> #include <netdb.h> #include <arpa/inet.h> #include <poll.h> #include <sys/event.h> #include <sys/time.h> int int...
C
/** * fixlengthstring.c * * a fixed length string * * created by Houor */ #include "stdio.h" #include "stdlib.h" #include "fixlengthstring.h" int assignString(FLString string, char *chars) { int i; int count; char *c; for (count = 0, c = chars; *c; ++count, ++c); if (count == 0) { ...
C
#include "msp.h" #include "movement.h" void mov_Initialize() { WDT_A->CTL = WDT_A_CTL_PW | WDT_A_CTL_HOLD; // stop watchdog timer P5->DIR = 0b00110000; // P5.4 and P5.5 as output P2->DIR = 0b11000000; // P2.6 and P2.7 as output P3->DIR = 0b11000000; // P3.6 and P3.7 as output P3->OUT = 0b11000...
C
// // Created by Sxing on 04/10/2021. // #ifndef INC_5__HEAD_H #define INC_5__HEAD_H #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <time.h> #define K 3 // num of categories of iris #define num_of_dim // num of dimension #define MAX_ROUNDS 100 // maximum number of iterations ...
C
#include <stdio.h> #include <stdlib.h> #include <stdbool.h> typedef struct Node{ int val; int parent; int depth; struct Node* next; } Node; typedef struct Graph{ Node** tree; } Graph; Node* newNode(int val){ Node* newNode = (Node*) malloc(sizeof(Node)); newNode->val = val; newNode->...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* insertionSort.c :+: :+: :+: ...
C
#include <ncurses.h> #include <stdlib.h> int rozmiar=1; void newgame() { endwin(); switch(rozmiar) { case 1: { system("./engine 1"); break; } case 2: { system("./engine 2"); break; } case 3: { system("./engine 3"); break; } case 4: { system("./engine 4"); break; } ...
C
#include <stdio.h> #define NAMELEN 20 #define PHONELEN 10 #define YEAR 4 struct student { char name[NAMELEN]; int id; char phone[PHONELEN]; float grade[YEAR]; int birthYear, birthMonth, birthDay; }; int main(void) { struct student john; printf("name is at %p\n", &(john.name)); printf("i...
C
 //スタックを用いた逆ポーランド電卓 #include <stdio.h> #include <stdlib.h> #define stack_size 100 #define stack_type int #define format "%d " #include "stack.h" //スタックに関する変数&関数の読み込み //逆ポーランド電卓の定数の定義 #define RET 0 #define NUM 1 #define PLUS 2 #define MINUS 3 #define MULT 4 #define DIV 5 #define OTHER 6 //キーボード入力された情報を取り込む int get...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "libCoresSom.h" #include <time.h> char senha[11],c; int a; main () { inicio: system("cls"); system ("mode 38,20"); gotoxy(5,5); printf("Senha:"); a = 0; do { fflush(stdin); c = getch(); if(isprint(c)) /*Analisa se o valor da...
C
/* * echo.c * * Created on: 2013-5-21 * Author: bear */ #include "stdio.h" int main(int argc, char * argv[]) { int i; printf("The First Application \n"); for (i = 0; i < argc; i++) printf("%s%s", i == 0 ? "" : " ", argv[i]); printf("\n"); while(1) ; return 0; }
C
#include <unistd.h> #include <signal.h> #include <stdlib.h> #include "my.h" //USER1 0 //USER2 1 void my_aff(int bin) { static int a; static int *str; int b; if (str == 0) str = malloc(sizeof(int) * 7); if (a < 7) str[a++] = bin; if (a == 7) { b = bintodec(str); my_putchar(b); ...
C
/****************************************** * * * File: main.c * Author: Michael McCann - mimccann * Partner: Bridges, Dyson - drbridge * School: Indiana University * Assignment: Lab 3 * Part of: Labs * Description: Turns on and off led, allowing button interface * Date Created: 01/26/17 * ...
C
#include <avr/io.h> #include <util/delay.h> #define bit_is_set(sfr, bit) (_SFR_BYTE(sfr) & _BV(bit)) #define bit_is_clear(sfr, bit) (!(_SFR_BYTE(sfr) & _BV(bit))) #ifndef cbi #define cbi(reg,bit) reg &= ~(_BV(bit)) #endif #ifndef sbi #define sbi(reg,bit) reg |= (_BV(bit)) #endif int getKey() //do task 3 { ...
C
#include <stdio.h> #include <stdlib.h> struct node{ int data; struct node *next; }; void push (struct node **old_head, int new_data) { printf("pushing %d\n", new_data); struct node *newnode; newnode = (struct node*)malloc(sizeof(struct node)); newnode->data = new_data; newnode->n...
C
#ifndef _BINARY_HEAP_H_ #define _BINARY_HEAP_H_ #include <stdlib.h> #include "vector.h" #include "utils.h" typedef struct binary_heap { vector_t *vector; unsigned data_size; int (*compare)(void*, void*, unsigned); } binary_heap_t; binary_heap_t* create_heap(unsigned data_size, int (*comp_func)(void*,void*)); void...
C
#include <stdio.h> int main(){ int a,b,c, soma1,soma2,soma3; printf("Digite o valor do primeiro segmento:"); scanf("%d",&a); printf("Digite o valor do segundo segmento:"); scanf("%d",&b); printf("Digite o valor do terceiro segmento:"); scanf("%d",&c); soma1 = b + c; soma2 = a + c; soma3 = a + b; ...
C
#include "libmybox.h" // xmalloc -- Exit unless we can allocate memory. void *xmalloc(size_t size) { void *ptr=malloc(size); if(!ptr) { printf("malloc() Out of memory, exiting\n"); exit(1); } return ptr; } // xstrndup -- Exit unless we can allocate a copy of thi...
C
#include "../include/input.h" static void shoot_pattern_1(Player* p){ int small_rad; double x1, y1; double speed = 15; small_rad = 10; x1 = p->c.x + p->c.radius ; y1 = p->c.y; create_bullet(&p->bullets, x1, y1, small_rad, speed, 0, 2*M_PI, FALSE, 100, GOOD_GUYS, p->bullets.size_real, 1) ; } static void shoo...
C
#include<stdio.h> /*17. Construa um algoritmo que dado um número, por exemplo 15, divida este número por 2 até que o resultado da divisão inteira seja menor que 2. Informe o número de divisões.  Exemplo: i. 15/2 = 7, sete é maior que 2 então divida ii. 7/2 = 3, ainda é maior que 2 então iii. 3/2 = 1, fim.*/ int main...
C
/*====================================================================================================*/ /*====================================================================================================*/ #include "drivers\stm32f4_system.h" #include "drivers\stm32f4_usart.h" #include "algorithms\algorithm_string.h...
C
#include"BTreeHead.h" int PrintLeavePath(Node* T,SeqStack* s) { if (T == NULL) { return 0; } PushStack(s,T->data); if(T->rchild == NULL && T->lchild == NULL) { PrintPath(s); printf("\n"); } PrintLeavePath(T->lchild,s); PrintLeavePath(T->rchild,s)...
C
#define _GNU_SOURCE // need for struct timezone under C99 #include <stdio.h> #include <unistd.h> #include <sys/time.h> #define N 2048 double alpha = 1.54645764567; double beta = 1.768679678; double A[N][N]; double B[N][N]; double C[N][N]; #ifdef TIME #define IF_TIME(foo) foo; #else #define IF_TIME(foo) #endif ...
C
// we could just implement put32/get32 and link it in. but we can also // implement the gpio_functions so that we can cross-check at a higher level. // this makes debugging differences alot easier. #include <stdio.h> #include <stdlib.h> #include "fake-pi.h" static unsigned bias = 2; // bias it more than 50/50. voi...
C
#include <stdlib.h> #include <stdio.h> #include <string.h> #include <sys/stat.h> #include <sys/types.h> #include <mqueue.h> #include <time.h> #include <errno.h> #include <regex.h> #include <getopt.h> #include <unistd.h> #include <ctype.h> #include <signal.h> #include "common.h" // Apuntador al fichero de log (se uti...
C
#include <stdarg.h> #include <stdio.h> /** * print_strings - Prints strings * Description: This is a variadic function prints strings * @separator: Separator space between numbers * @n: Number of parameters * Return: */ void print_strings(const char *separator, const unsigned int n, ...) { va_list args_list; u...
C
#include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <netdb.h> int main(int argc, char *argv[]) { char buffer[1024] = {0,}; struct sockaddr_in remote_addr; ...
C
/* ************************************************************************** */ /* LE - / */ /* / */ /* ft_strreplace_first.c .:: .:/ . .:: ...
C
/* ʼ Լ */ #include "bluemarble.h" void DrunkParty() { int rn, rn2; rn = rand() % 3; if (rn == 0) // { rn2 = (rand() % 5) + 1; gotoxy(2, 37); setcolor(0, 12); printf("ڷ %dĭ ϴ.", rn2); setcolor(0, 15); Move_Pieces(-rn2, 200); } else if (rn == 1) // { rn2 = (rand() % 5) + 1; gotoxy(2, 37); se...
C
#include "firebert.h" #include <pcap.h> #ifdef __OpenBSD__ #include <queue.h> #include <net/if.h> #include <net/if_arp.h> #include <netinet/if_ether.h> #else #include <net/ethernet.h> #endif #include "ether_utils.h" #define ETHERTYPE_ISL ETHERMTU - 1 #define HEADER_LEN_ISL 26 #define HEADER_LEN_8021Q 4 /* ------...
C
#include <sys/cdefs.h> #include <err.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <stdint.h> void strnsubst(char **, const char *, const char *, size_t); /* * Replaces str with a string consisting of str with match replaced with * replstr as many time as can bedone before the constructed...
C
#ifndef _STRUCTS_XML_H_ #define _STRUCTS_XML_H_ /******************************************************************************* * XML API ******************************************************************************/ /* Flags to structs_xml_input() */ #define STRUCTS_XML_UNINIT 0x0001 /* data object needs initial...
C
/** @filename : test_eeprom.c **/ #include <stdio.h> #include <stdint.h> #include <fcntl.h> #include <unistd.h> #include <string.h> /** **/ #define EEPROM_NAME_STR "/sys/bus/i2c/devices/1-0050/eeprom" #define EEPROM_BUF_SIZE 256 #define BYTES_PER_LINE 8 /** **/ int main(int argc, char *argv[]) { int fd; ...
C
#include"StateMachineImplementation.h" StateMachineStructure stateMachineData; static uint8_t lineCount = 0; static uint8_t lineSize = 0; //Used to print something if an error occurs. void printError() { //printf("Error \n"); } //Prints the current state. void printCurrentState() { printf("CurrentState : %d - Ch...
C
main(i,a){char n[101];scanf("%s",n);a=strlen(n)-1;for(i=0; i<=a/2; i++){if(n[i]!=n[a-i]){puts("NO");return 0;}}puts("YES");} ./Main.c:1:1: warning: return type defaults to int [-Wimplicit-int] main(i,a){char n[101];scanf("%s",n);a=strlen(n)-1;for(i=0; i<=a/2; i++){if(n[i]!=n[a-i]){puts("NO");return 0;}}puts("YES");} ...
C
#include "myStrHead.h" int myStrcmp(char *str1,char *str2){ if(str1==NULL||str2==NULL) return 0; while(*str1&&*str2){ if(*str1>*str2) return 1; else if(*str1<*str2) return -1; ++str1; ++str2; } if(*str1) return 1; else if(*str2) return -1; else return 0; }
C
#include <stdio.h> /** * main - Prints all possible combinations of three different digits, * in ascending order, separated by a comma followed by a space. * Return: Always 0. */ int main(void) { int w; int y; int x; for (w = 0; w < 8; w++) { for (y = w + 1; y < 9; y++) { for (x = y + 1; x < 10; x++) { pu...
C
/** name : k_data.h date 2015.09.24 describe : ʡݱ copyright : ʹ, Dzڲ汾ŵ¶޸. note : Щ k_base.h updata : 1) */ #ifndef __K_DATA_H__ #define __K_DATA_H__ #include <stdio.h> #include <stdlib.h> #include <math.h> #include <float.h> #include "k_error.h"...
C
#include <naiveConsole.h> enum FD{ STDOUT=0, STDERR}; void write_handler(uint64_t fd, char * buffer, int strlen) { char cadena[strlen+1]; int i=0; for (i = 0; i < strlen; ++i) cadena[i] = buffer[i]; cadena[i]= 0; switch(fd) { case STDOUT: print(cadena); break; case STDERR: printFormat(cadena, BL...
C
#include "test_theft.h" #include "test_theft_autoshrink_bulk.h" static void bb_free(void *instance, void *env); static void bb_print(FILE *f, const void *instance, void *env); /* Generate a block of random bits, with a known size. * This is mainly to exercise `theft_random_bits_bulk`. */ static enum theft_alloc_res ...
C
CVariables_To_LR_Parameter() { int iValue = 100; char *sBuff = "This is loadrunner session"; char *sMovie = "Aquaman"; float fValue = 10.26; // Prior declaration is required for C variable (Int, float, char[], char *) // Prior declaration is not required of LR parameter lr_save_int(iValue, "iParam"); /...
C
#include "Analysis.h" #include <stdio.h> #include <assert.h> #include <string.h> #include <stdlib.h> #include <ctype.h> static MazeMap mm; static int distsq; extern const char *pick_move(MazeMap *mm, int distsq); static char *get_line(bool remove) { static char buf[1024]; static char *cur_line = NULL; ch...
C
#include "stdio.h" void main(void) { int day, month, i; printf("Day:"); scanf("%i", &day); printf("Month:"); scanf("%i", &month); if (day > 31 || day < 1 || month > 12 || month < 1) printf("Wrong information\n"); else { i = day; day = month; month = i; printf("Day:%i Month:%i\n", day, month); } }
C
#include <stdio.h> #include <math.h> /*Função que calcula o valor de delta*/ double delta(double a, double b, double c) { double delt ; if (a!=0) { delt = (pow(b, 2) - 4*a*c) ; return delt ; } else { printf("Operação finalizada\n") ; } } /*Funç...
C
#include <stdio.h> #include <stdlib.h> #include "myLib.h" #include "background.h" #include "game.h" #include "spritesheet.h" ANISPRITE tank; BEACON beacons[NUMBEACONS]; TARGET target; TARGET traps[NUMTRAPS]; enum {UP, RIGHT, DOWN, LEFT}; enum {NUL, SE, SW, NW, NE, NN, EE, SS, WW}; int gmState; int loseCount; int can...
C
/*program for to find the factorial of a number*/ #include<stdio.h> #include<conio.h> void main() { int f,n; f=1; printf("enter any number:"); scanf("%d",&n); while(n>=1) { f=f*n; n--; } printf("%d",f); }
C
/* ** my_strcat.c for my_strcat in /home/thibaut/Repository/PSU_2016_minishell2 ** ** Made by Thibaut Trouvé ** Login <thibaut.trouve@epitech.eu> ** ** Started on Wed Apr 5 20:58:35 2017 Thibaut Trouvé ** Last update Wed Apr 5 21:03:19 2017 Thibaut Trouvé */ #include "my.h" void my_strcat(char *dest, char *src...
C
/* * LED_Blink_with_Timer_in_CTC_mode.c * * Created: 5/12/2017 1:23:51 AM * Author : Vasileios Amoiridis */ #include <avr/io.h> int main(void) { DDRB |= (1 << DDB0); //Set PINB0 as output PORTB &= ~(1 << PORTB0); //Set PINB0 to 0v TCCR1B |= (1 << WG...
C
#include <stdio.h> #include <unistd.h> #include <string.h> #include <fcntl.h> #include "cJSON.h" // HW8_2 : device json parser // 20132138 // Jungwoo Song // Usage : gcc 8_20132138_2.c cJSON.c -o 8_20132138_2.out char* create_device_json(void); int main(void){ char json[1024]; int nread; int fd; if(...
C
#include <assert.h> #include <stdio.h> #include "ray2.h" void kmRay2Fill(kmRay2* ray, kmScalar px, kmScalar py, kmScalar vx, kmScalar vy) { ray->start.x = px; ray->start.y = py; ray->dir.x = vx; ray->dir.y = vy; } kmBool kmRay2IntersectLineSegment(const kmRay2* ray, const kmVec2* p1, const kmVec2*...
C
#include<stdio.h> int main() { int r,i,sum, ch,rem,ca = 0; while(scanf("%d %d",&r,&i) == 2 && (r != 0 || i != 0)){ ca++; if(i == 0 || r == 0){ printf("Case %d: impossible\n",ca); } else{ sum = r - i; ch = sum / i; rem = sum % i; ...
C
#include <stdio.h> int max(int a, int b) { if (a > b) return a; else return b; } void display(int arr[], int n) { for (int i = 0; i < n; i++) { printf("%d ", arr[i]); } printf("\n"); } int upper_bound(int arr[], int item, int n) { int low = 0, high = n - 1; w...
C
#include <stdio.h> #include <conio.h> char operator; int a,b,c; void main() { printf("\tSIMPLE CALCULATOR\n\n"); printf("+.Addition\n-.Subtraction\n*.Multiplication\n/.Division\n"); printf("Enter the operation to be performed on the operands:"); scanf("%c",&operator); printf("Enter two operands:"); sc...
C
#include <prototype-os/boot/bootloader/x86/asm.h> #include <prototype-os/types.h> u8 kbdmap[] = { 0x1B, 0x1B, 0x1B, 0x1B, /* esc (0x01) */ '1', '!', '1', '1', '2', '@', '2', '2', '3', '#', '3', '3', '4', '$', '4', '4', '5', '%', '5', '5', '6', '^', '6', '6', '7', '&', '7', '7', '8', '*', '8', '8', ...
C
#include <stdio.h> #include <errno.h> #include <errno.h> #include <termios.h> #include <unistd.h> #include <fcntl.h> FILE* init_serial(void); int main(int argc, char *argv[]) { FILE *writefile, *serialport; char sprint[256]; if (argc != 2) { printf("Incorrect number of arguments. Please only pass the address o...
C
#include <stdio.h> int main(){ int a[5] = {1,2,3,4,5}; int *p = a; int i; for (i=0; i<5;i++){ printf("0x%p 0x%p %d\n ", &a[i], &p[i], p[i]); } printf("%d", *p+1 ); }