language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* filler.h :+: :+: :+: ...
C
#include<stdio.h> int main(void){ char word[] = "abc de fg hijk ablmn"; int two[625][3] = {{0}}, i=0, j=0, DA=0, DB=0; printf("%s\n", word); while(word[i] != 0x00){ if(word[i] >= 'a' && word[i] <= 'z'){ DA=1; } if(word[i+1] >= 'a' && word[i+1] <= 'z'){ DB=1; } if(DA == 1 && DB == 1){ do{ i...
C
#include <limits.h> #include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> // ???? #define D_DIGIT_CNT 19 // ?????? #define D_NG_NUM1 4 // NG?? #define D_NG_NUM2 9 // NG?? // ???? static FILE *szpFpI; // ?? // ???? - ???? ...
C
/* ** EPITECH PROJECT, 2021 ** Tek2 ** File description: ** array_emplace_primitive.c */ #include <stdio.h> #include <stdlib.h> #include "../jsnp_header.h" jsnp_value_t *array_emplace_primitive_back(jsnp_value_t *u, int value) { jsnp_value_t *v = malloc(sizeof(jsnp_value_t)); if (!v) return (perror(...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* buffer_function.c :+: :+: :+: ...
C
void hexdump(char *data, unsigned int length){ unsigned int i = 0; while(i < length){ printf("%02x ", (unsigned char)data[i++] & '\xff'); } } frag_hole_t *hole(guint16 start, guint16 end){ // Creates a fragment hole record frag_hole_t *newhole = NULL; newhole=(frag_hole_t*)malloc(sizeof(frag_hole_t)); if(ne...
C
//https://blog.noctua-software.com/c-lambda.html #include <stdio.h> void func(int nb, void (*f)(int)){ int i; for(i = 0; i < nb; i ++) f(i); } int main () { void callback(int v){ printf("%d\n", v); } func(4, callback); fprintf (stdout, "====\n"); func(4, ({ void _(int v){ ...
C
//wap to input side of a square & calculate its area & parameter// main() { int s,a,p; clrscr(); printf("enter side="); scanf("%d",&s); a=s*s; p=4*s; printf("\n\nArea=%d\n\nparameter=%d",a,p); getch(); }
C
#include <errno.h> #include <fcntl.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/stat.h> #include <unistd.h> int random_int() { int fd = open("/dev/random", O_RDONLY); if ( fd == -1) { printf("couldn't open: %s\n", strerror(errno)); return 0; } int rando; if (read(fd, &rando, s...
C
// // Created by Fabian Terhorst on 11.10.17. // #include <stdio.h> #include <stdlib.h> #include "single_linked_list.h" #include "single_linked_list_tests.h" #include <limits.h> struct MenuItem { char* name; void (* fct)(struct Node*); }; bool running = true; void initMenuItem(struct MenuItem* menuItem, ch...
C
#include<stdlib.h> #include<stdio.h> int main (void) { int* data = (int*)malloc(100 * sizeof(int)); data[0] = 18557; printf("%d\n", data[0]); free(data); printf("%d\n", data[0]); return 0; }
C
#include"stdio.h" #include"unistd.h" int main() { pid_t firstch, secondch; pid_t returnR; firstch = fork(); if(firstch>0) { printf("I am Parent Proccess ID %d and my Child is in Execution...\n",getpid()); returnR = wait(NULL); printf("I am Parent Proccess ID %d and my Child is in terminated... and wait r...
C
#include "audio.h" void loadSound(int index, char *name) { /* Load the sound specified by the filename */ if (index < 0 || index >= MAX_SOUNDS) { printf("Invalid index for sound! Index: %d Maximum: %d\n", index, MAX_SOUNDS); exit(1); } sound[index].effect = Mix_LoadWAV(name); if (sound...
C
#include<stdio.h> #include<conio.h> #include<alloc.h> typedef struct celula_lista { int k; struct celula_lista *next; } LIST; typedef struct coada { LIST *front,*rear; } QUEUE; QUEUE *newq(QUEUE *q) { q=(QUEUE *)malloc(sizeof(QUEUE)); q->front=q->rear=NULL; return(q); } int emptyq(QUEUE *q) {if((q->fron...
C
/* ** EPITECH PROJECT, 2020 ** B-CPE-110-PAR-1-3-pushswap-perry.chouteau ** File description: ** init.c */ #include "../includes/include.h" void describe(void) { my_printf("USAGE\n"); my_printf(" ./push_swap [nombre1, nombre 2, ...]\n"); my_printf("DESCRIPTION\n"); my_printf("sort all number, giving...
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 main() { int i; char c; scanf("%d", &i); c = i; printf("c=%d\n", c); printf("c='%c'\n", c); printf("%d",(short)32); return 0; }
C
#include "server.h" int serv_list(int sock_data, int sock_control) { char data[MAXSIZE]; size_t num_read; FILE *fd; if (system("ls -l | tail -n+2 > .tmp") < 0) { exit(1); } if (!(fd = fopen(".tmp", "r"))) { exit(2); } /* Seek to the beginning of the file */ ...
C
/****************************************Copyright (c)*************************************** ** http://www.openmcu.com **------------------------------------------------------------------------------------------- ** File name: main.c ** Last modified Date: 2013-01-04 ** Last ...
C
/** * Yes, this code works. No, it's not good practice. Fix all the issues here! * */ int main(void) { printf("What's up, world?!\n"); return 0; }
C
#include <stdio.h> #define SIZE1 2; #define SIZE2 3; int main(){ /*int ar1[][2] = {{1,2}, {3,4},{5,6}}; int i,j; for(i=0; i<3; i++){ for(j=0; j<2; j++){ printf("%d",ar1[i][j]); } putchar('\n'); }*/ int ar2[][3][2] = {{{1,2},{3,4},{5,6}},{{7,8},{9,0},{1,2}}}; for(int i = 0; i<2; i++) { for(int j=0; j...
C
#include <stdio.h> #include <math.h> #include "audioDeviceInterface.h" #include "queue.h" #ifndef M_PI #define M_PI (3.14159265) #endif #define DURATION (SAMPLE_RATE * 3) int main(){ /* Test Sound Data Generation */ float sine[DURATION]; int f = 400; for(unsigned long i = 0; i < DURATION; i++){ sine[i] = sin(2...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> #include "disparity.h" /******************************** Author: Sravanthi Kota Venkata ********************************/ void padarray4(I2D *inMat, I2D *borderMat, int dir, I2D *paddedArray) { int rows, cols, bRows, bCols, newRows, newCols; int i, j; in...
C
//#include<stdio.h> // //void main() //{ // // int limparQ = 10; // // do{ // printf("Limpando : %i\n",limparQ); // limparQ--; // // }while(limparQ > 0); // // printf("Limpei tudo : %i\n",limparQ); //}
C
/* CS 214: Systems Programming Spring 2018 * Professor Francisco * Assignment 1: To Build A Better Malloc * Richard Farrington netid: raf172 * Anirudh Tunoori netid: at813 */ //mymalloc.c #include <stdlib.h> #include <ctype.h> #include <stdio.h> #include <string.h> #include "mymalloc.h" static char mem[5000...
C
#include <stdio.h> #define MAX_PROB 10000 #define MAX_N 25 typedef unsigned long DWORD; /* From NEW VARIATIONS ON THE TOWER OF HANOI by PAUL K. STOCKMEYER AND FRED LUNNON procedure Turtle(n) { stack = 0; Move(1, 0, 0, 1); for i from 1 to n-1 do stack = 1-stack; Move(i, stack, 2*stack, 2*stack+2); Hanoi(...
C
#include "game.h" static ship_t ship; static bullet_t bullets[NUM_BULLETS]; static comet_t comets[NUM_COMETS]; static explosion_t explosions[NUM_EXPLOSIONS]; bool keys[5] = { false, false, false, false, false }; bool is_game_over = false; enum STATE { TITLE, PLAYING, LOST }; int state = TITLE; void game_init() { ...
C
#include<stdio.h> int main() { int a,s=0,sum=0; int n; scanf("%d%d",&n,&a); while(n--) { s=s+a; printf("%d ",s); sum =s+10*sum; // n--; } printf("\n%d",sum); 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> #include <stdlib.h> #include <assert.h> unsigned long myGap(void *p0, void *p1) { size_t a0=(size_t)p0, a1=(size_t)p1; return((a0 <= a1) ? a1-a0 : a0-a1); } //// FUNCTION TESTING BELOW // This Works, I chose 'unsigned long' manually opposed to size_t unsigned long addrGap(void *a0, void *a1)...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <errno.h> #include <fcntl.h> #include <signal.h> static void sighandler(int signo) { if(signo == SIGINT) { int fd = open("file.txt", O_APPEND | O_RDWR | O_CREAT); printf("Errno: %d\n", errno); if(errno !...
C
#include<stdio.h> #include<conio.h> int arena(int start,int end) { int i,j; int arr[7][3]= { { 13,14,15 }, { 12,-1,11 }, { 9,-1,10 }, { 8,-1,7 }, { 5,-1,6 }, {...
C
/* Author : Van Nguyen * Class : Data Structures * Project : CSV Data * Due Date: 2019.02.22 */ #include <stdio.h> #include <stdlib.h> struct item_list { char name[32]; float price; int quantity; }; void csv_reader(void); void print_struct(struct item_list [], int); int main(void) { ...
C
#include<stdio.h> #include<conio.h> int main() { int a[10],i,n; printf("enter array element"); scanf("%d",&n); for(i=0;i<=n;i++) { printf("\narray %d",i); } int min=a[i],temp,j; for(i=0;i<n;i++) { for(j=i+1;j<n;j++) { if(min<a[i]) { temp=a[i]; a[i]=a[j]; a[j]=temp; printf("%d",a[i]); } } } getch(); return 0; }
C
#include <errno.h> #include <stdio.h> #include <string.h> #include <unistd.h> #include <sys/types.h> #include <sys/mman.h> typedef struct { unsigned char sbox[256]; unsigned char i, j; } RC4_CTX; void RC4_set_key(RC4_CTX *c, size_t keybytes, unsigned char *key) { int i, j; unsigned char keyarr[25...
C
#include <stdio.h> int main(){ printf("문자 상수 A = %c\n",'A'); printf("문자 상수 A의 정수형 상수(ASCII Code) = %d\n", 'A'); printf("97 정수형 상수(ASCII Code)의 문자 상수 = %c\n", 97); return 0; }
C
/******************************************************** * File name: Share_Memory.c * Features:Shared memory and Semaphore * Created Time:2019-07-08 * ******************************************************/ #include<unistd.h> #include<stdlib.h> #include<sys/types.h> #include<string.h> #include <errno.h> #inclu...
C
/** * @mainpage * # Загальне завдання * 1. На оцінку **"Задовільно"**, необхідно виконати завдання стосовно варіанту, обчислений за раніше-визначеною формулою. * * # Індивідуальне завдання * 6. Текст - це програма на мові С. Визначити, чи є у наведеному тексту ві пари дужок: (), {}, []. При реалізації цього завда...
C
/* findBooks.c * * Contains: * int main(int argc, char *argv[]) * * This main program reads through the first input file * of library/book pairs and fills them into a hash table. * Then the program prints the list of libraries each book * in the second finput file belongs to. * * Author: * Dylan Woodbury ...
C
/* ** get_paths_from_env.c for minishell2 in /home/auzou_t/PSU_2014_minishell2 ** ** Made by Thibaud Auzou ** Login <auzou_t@epitech.net> ** ** Started on Wed Nov 26 15:20:21 2014 Thibaud Auzou ** Last update Wed Nov 26 17:04:56 2014 Thibaud Auzou */ #include <stdlib.h> #include "my.h" int get_paths_from_env(t_...
C
#include "mocktime.h" #include "ctest.h" #define ASSERT_TIMEVAL_EQUAL(expected, actual) \ do { \ ASSERT_EQUAL((expected).tv_sec, (actual).tv_sec); \ ASSERT_EQUAL((expected).tv_usec, (actual).tv_usec); ...
C
#include<stdio.h> #include<string.h> /* */ char palavrasReservadas[6][10] = {"char", "for", "int", "return", "void", "while"}; void processaPalavra(int ocorrencias[6][25], char palavra[50], int nLinha){ int i; for(i = 0; i<6; i++){ if(strcmp(palavrasReservadas[i],palavra) == 0){ ocorrencias[i][nLinha-1] ...
C
// // Created by citiral on 9/23/16. // #include "stdlib.h" #include "stdio.h" #include "ctype.h" #include "cpu/cpu.h" long int strtol(const char* str, char** endptr, int base) { int result = 0; bool isPos = true; while (isspace(*str)) { str++; } if (*str == '-'...
C
#include"SqStack.h" #include<stdio.h> #include<stdlib.h> /** * @name : tatus initStack(SqStack* s, int sizes) * @description : initialize a Stack * @param : s,size * @return : Status * @notice : None */ Status initStack(SqStack* s, int sizes) { //s = (SqStack*)malloc(sizeof(...
C
#include <stdio.h> #include <stdlib.h> #include <omp.h> //########################################## // // PCPC _ Assignment 08 // Maximilian Weß && Christoph Rauterberg // //########################################## // Moep? Solution so simple as to simply but a dynamic for loop around it? // DONE ? void factori...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> #define BOARD '~' #define SPACE ' ' #define VERT '|' #define HORZ '_' const int size = 10; const char *word; const char *four[10] = {"CATS", "SLAP", "CLAW", "PUSH", "FORD", "IPAD", "BEER", "MILK", "FIRE", "DOGS"}; const char *five[10] = {"KITTY", "CABLE", "FLAM...
C
/* ***************************************************************** */ /* File name: pid.c */ /* File description: This file has a couple of useful functions to */ /* control the implemented PID controller */ /* Author name: julioalvesM...
C
#include "graphics.h" typedef struct { int x,y; } point; const point ovalInit = {150,150}; const int widthInit = 30; const int lengthInit = 70; const int widthInc = 10; const int lengthInc = 10; const int ovalToDraw = 5; int main () { int width = widthInit; int length = lengthInit; point ovalPoint = ovalInit;...
C
#define _CRT_SECURE_NO_WARNINGS 1 #include<stdio.h> #include<assert.h> //ģʵstrlen //1.汾 int my_strlen(const char* str) { assert(str); int count = 0; while (*str != '\0') { count++; str++; } return count; } //2.ݹ汾 int my_strlen(const char* str) { assert(str); if (*str == '\0') return 0; else return 1...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "grid.h" Grid_T sudoku_read(void){ Grid_T *s=(Grid_T *)malloc(1*sizeof(Grid_T)); int i=0,j=0,el; while((el=getchar())!=EOF) { if(el>='0' && el<='9'){ grid_update_value(s, i, j, el-'0'); j++; } else if(el=='\n'){ i++; j=0;...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <pthread.h> int thread_count; double f(double x){ double y = x*x; return y; } double Trap(double left_endpt,double right_endpt,int trap_count,double base_len){ double estimate,x; int i; estimate = (f(left_endpt)+f(right_endpt))/2.0; for(i=1;i...
C
/* * btleaf_page.C - implementation of class BTLeafPage * * Johannes Gehrke & Gideon Glass 951016 CS564 UW-Madison * Edited by Young-K. Suh (yksuh@cs.arizona.edu) 03/27/14 CS560 Database Systems Implementation */ #include "btleaf_page.h" #include <cstdio> #include <cstring> const char* BTLeafError...
C
// // testRlp.c // CoreTests // // Created by Ed Gamble on 7/23/18. // Copyright © 2018-2019 Breadwinner AG. All rights reserved. // // See the LICENSE file at the project root for license information. // See the CONTRIBUTORS file at the project root for a list of contributors. #include <stdio.h> #include <stdl...
C
/* * ===================================================================================== * * Filename: allocator_pool.c * * Description: allocator_pool c source file * * Version: 1.0 * Created: 04/22/2019 03:51:01 PM * Revision: none * Compiler: gcc * * Au...
C
#include "pch.h" // Tree Memory Allocation structure. typedef struct _POOLMEMORYBLOCK POOLMEMORYBLOCK, *PPOOLMEMORYBLOCK; struct _POOLMEMORYBLOCK { DWORD Index; DWORD Size; PPOOLMEMORYBLOCK NextBlock; PPOOLMEMORYBLOCK PrevBlock; PBYTE ...
C
# include <stdio.h> int a; void main() { printf("Enter the Number\n"); scanf("%d",&a); printf("The entered number is:%d\t\n",a); if (a>0) { printf("It is a Positive Number"); } else if (a==0) { printf("It is neigher a Positive Nor Negative number"); } else { ...
C
/** @file buf.c * * Simple memory buffers. * * Copyright 2009 Simon Kallweit * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 ...
C
#include <stdio.h> #include <stdio.h> #include <termios.h> #include <unistd.h> #include "player.h" #include "starship.h" #include "stage.h" static int play_char(){ //got to check if window focus struct termios oldt, newt; int ch; tcgetattr( STDIN_FILENO, &oldt); newt=oldt; newt.c_lflag &= ~(ICANON); ...
C
#include "lists.h" /** * print_list - prints all the elements of a list * @h: header * Return: count being i */ size_t print_list(const list_t *h) { int i; if (h == NULL) return (0); for (i = 0; h; i++) { if (h->str != NULL) { printf("[%u] ", h->len); } else { printf("[%u] ", 0); } if (h->str != NULL) { printf("...
C
#include <stdio.h> #define MIN(a,b) (a<b ? a:b) int main() { long long int k, n, p, y, x, z, m, a, b, tmp; int i, input; scanf ("%d", &input); for (i=0; i<input; i++) { scanf ("%lld %lld", &n, &k); if (k==n) { printf ("1\n"); continue; } y = n-1; z = MIN ...
C
/* This program will kill approxamatly 35 seconds of time. */ main() { int x; long int y; for(x=0; x<10; x++) { for(y=0; y<1000000; y++); } }
C
/* * Example of client using XNS IDP protocol. */ #include "xns.h" main(argc, argv) int argc; char *argv[]; { int sockfd; struct sockaddr_ns cli_addr, serv_addr; pname = argv[0]; /* * Fill in the structure "serv_addr" with the address of the * server that we want to send to. */ bzero((char *) &serv_...
C
#include <stdio.h> #include <unistd.h> #include <sys/socket.h> #include <bluetooth/bluetooth.h> #include <bluetooth/rfcomm.h> #include "util.h" #define SERVER_DEVICE "00:1A:7D:DA:71:11" int main(int argc, char **argv) { struct sockaddr_rc addr = { 0 }; int s, status, bytes_read; char buf[1024]; char **joystickDat...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strsplit.c :+: :+: :+: ...
C
#include "libft.h" char *ft_strncpy(char *d, const char *s, unsigned int n) { unsigned int l; l = ft_strlen(s); if (l >= n) { ft_memcpy((void*)(d), (const void*)(s), n); } else { ft_memcpy((void*)(d), (const void*)(s), l); ft_bzero((void*)(d + l), n - l); } return (d); }
C
/* mex Function nakeinterp1.c */ ////////////////////////////////////////////////////////////////////////// // mex function nakeinterp1.c // Dichotomy search of indices // Calling: // idx=nakeinterp1(x, y, xi); // where x, y and xi are double column vectors // x must be sorted in ascending order; x and y have the same ...
C
#include <stdio.h> #include <pthread.h> int global_variable = 0; void* increment_global_var(void* mutex_pointer) { int increment_count, delay_count; mutex_pointer = (pthread_mutex_t*) mutex_pointer; for(increment_count = 0; increment_count < 10; ++increment_count) { // critical section ...
C
/* ** my_str_to_wordtab.c for my_str_to_wordtab in /home/lardet_e/rendu/PSU_2013_minishell2/LIB ** ** Made by lardet ** Login <lardet_e@epitech.net> ** ** Started on Sat Nov 30 16:38:30 2013 lardet ** Last update Sat Nov 30 17:10:00 2013 lardet */ #include <stdlib.h> int is_alpha_n(char c) { if (c >= 33 && c <...
C
/* URI Online Judge | 1046 Game Time Adapted by Neilor Tonin, URI Brazil https://www.urionlinejudge.com.br/judge/en/problems/view/1046 Timelimit: 1 Read the start time and end time of a game, in hours. Then calculate the duration of the game, knowing that the game can begin in a day and finish in another day, with a...
C
// // Created by cotton on 2020/4/16. // #include <stdio.h> #include <ctype.h> int getch(void); void ungetch(int c); int getint(int *p); int getfloat(float *p); int main() { float a[3]; int i; for (i = 0; getfloat(&a[i]) != EOF; i++) ; for (i = 0; i < 3; i++) { printf("%f\n", a[i]);...
C
/* * income.c * * Created on: 8 May 2021 * Author: npenayo */ #include "Income.h" #include "Taxpayer.h" #include "Arrays.h" #include "Validations.h" #include <string.h> #include <stdio_ext.h> #include <stdlib.h> int getId(Income *incomes, int arrLength, char *description, int *output) { int resp = 0; for...
C
#include <stddef.h> #include <stdbool.h> #include <fllib/Std.h> #include <fllib/Mem.h> #include <fllib/Cstring.h> #include "result.h" FlutAssertResult* flut__assert_int_equals(int expected, int actual) { struct FlutAssertResult *result = flut_assert_result_new(); result->success = expected == actual; i...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> #include <mpi.h> #include <time.h> long int N; #define PI2 6.2832 void computaDFT(long int ini, int chunk, float *P, float *Xim, float *Xre, float *x){ long int k, n; int auxK; auxK = ini; for(k=0; k<chunk; ++k){ for (n=0 ; n<N ; ++n) Xre[k] += x[n] ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> int main() { int i, j; char p[5] = "lmnop"; char s[7] = "lmmnoop"; int t[strlen(p)][strlen(s)]; for(i = 0 ; i <strlen(s); i++) { t[0][i] = 0; } for(i = 0; i <= strlen(p); i++) { t[i][0]=0; } for(i...
C
/*gpush.c IBM 19.03.1995 H.Schildt interpreter for student studing */ #include "schildt.dfn" void gpush(s) char *s; { extern int gtos; extern char *gstack[]; gtos++; if (gtos == SUB_NEST) { serror(12,"gpush"); return; } gstack[gtos] = s; } /*------...
C
#include <gtk/gtk.h> #include <ctype.h> #include "Bouttons.h" #include "Var_Global.h" #include "Gtk_Widgets.h" #include "Couleur.h" #include "setColor.h" #include "Gagner.h" // ce fichier contient la fonction executee en cliquant sur entre (saisie d une tentative) void on_Txt_activate (GtkEntry *e){ Tr = 0; ...
C
// HttpUtilParseUri test #include <stdio.h> #include <stdarg.h> #include <stdlib.h> #include <string.h> #include <http/util.h> #include <sysmodule/sysmodule.h> #define HTTP_POOL_SIZE (64 * 1024) #define SSL_POOL_SIZE (256 * 1024) uint8_t httpPool[HTTP_POOL_SIZE]; uint8_t sslPool[SSL_POOL_SIZE]; //ty...
C
/************************************************************************* > File Name: test_umask.c > Author: Kangyijie > Mail:Kangyijie5473@gmail.com > Created Time: 2016年07月18日 星期一 20时17分00秒 ************************************************************************/ #include<stdio.h> #include<stdlib.h> #includ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* main.c :+: :+: :+: ...
C
#include <stdio.h> #include <math.h> #pragma warning(disable:4996) int Judge3(int n); int Judge2(int m); int Judge1(int k); int Judge3(int n) { /*int ret = m; int count = 0; int num = 0; int i = 0; int flag = 1; int arr[10000]; for (i = 0; i < 10000; i++) { arr[i] = 0; } while (m) { arr[count++] = m %...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> //iloczyn macierzy przez wektor(macierz jednowymiarowa) void wczytaj(FILE *fin, int *wiersze, int *kolumny, float macierz[100][100]){ float liczba = 0; if(fscanf(fin, "%d", wiersze) != 1){ printf("Pierwszy napis nie jest liczba calk...
C
#ifndef HOLBERTON_H #define HOLBERTON_H int _putchar(char c); char *create_array(unsigned int size, char c); /*Creates an array of chars*/ char *_strdup(char *str); /*returns a pointer to a new string which is a duplicate of the string str(its parameter*/ char *str_concat(char *s1, char *s2); /*Concatenates two strings...
C
#include<stdio.h> int main() { int a=5,*aa; aa=&a; a=power(&aa); printf("\na=%d aa=%u",a,aa); } int power(int **ptr) { int b; b=**ptr***ptr; return b; } /* Output: a=25 aa=235822204 */
C
#include <stdio.h> #include <stdlib.h> int main(void) { int n; int *a; int i; int j; int tmp; while (scanf("%d", &n) != -1) { a = malloc(sizeof(int)*n); for (i=0; i<n; ++i) { scanf("%d", &a[i]); } for (j=0; j<7; ++j) { for (i=0; i<n; ++i) { scanf("%d", &tmp); if (a[i] > tmp) a[i] = tm...
C
#include "holberton.h" /** * _strstr - locates a substring * @haystack: the string to search * @needle: the substring to search for in haystack * * Return: pointer to beginning of the located substring */ char *_strstr(char *haystack, char *needle) { int h_ndx, n_ndx; char *point; if (needle[0] == '\0') ret...
C
/* * Verwendung von malloc/realloc: * Speicher nach Bedarf aus dem heap * void* generische Pointer * - nicht dereferenzierbar * - zuweisungskompatibel zu jedem getypten Pointer * - keine Arithmetik * */ #include <stdio.h> #include <stdlib.h> #include "st1f.h" #include "st1io.h" FILE* pf; int anz=0; char vbuf[...
C
// // utils.c // p2p // // Created by septimus on 15/7/5. // Copyright (c) 2015年 SEPTIMUS. All rights reserved. // #include "utils.h" void insert_substring(char *a, char *b, int position) { char *f, *e; int length; length = strlen(a); f = substring(a, 1, position - 1 ); e = substring(a,...
C
#include "../inc/uls.h" void print_file_names_l_flag(char **file_names, int name_amnt, int k){ struct stat buf; char *buff_time = (char *)malloc(32 * sizeof(char)); struct passwd *psd; struct group *grp; if(lstat(file_names[k], &buf) == -1){ mx_printerr("stat error\n"); exit(0); ...
C
#include<stdio.h> int main() { int nHours=40; int nDays=7; float avg=nHours/nDays; // WITHOUT TYPECASTING. printf("%d hours in %d days\n",nHours,nDays); printf("work %.lf hours per day\n",avg); printf("\n\n"); int nHour=40; int nDay=7; float av=nHour/(float)nDay; // WITHOUT TYPECASTING...
C
#include <stdio.h> int main(){ int a,i,j; scanf("%d",&a); a=45*45-a; for(i=1;i<=9;i++)for(j=1;j<=9;j++)if(i*j==a){ printf("%d x %d\n",i,j); } return 0; }
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <windows.h> int main(int argc, char **argv) { unsigned int number_of_raw_input_devices; RAWINPUTDEVICELIST *raw_input_device_list; unsigned int raw_input_device_number; GetRawInputDeviceList(NULL, &number_of_raw_input_devices, sizeof...
C
#include <stdio.h> char *ft_strlowcase(char *str); int main(int argc, char **argv) { if (argc != 2) { printf("%s\n", "Input a Single String as an Argument"); return (1); } printf("%s\n", ft_strlowcase(argv[1])); return (0); }
C
#include "apue.h" #include <sys/stat.h> #include <sys/types.h> /* determine socket stat members */ int main(void) { struct stat sbuf; int sockfd; bzero(&sbuf, sizeof(struct stat)); if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) err_sys("socket error"); if (fstat(sockfd, &sbuf) == -1) err_sys("fstat error...
C
//Jacky Wong //jagwong@ucsc.edu //ID:1281439 #ifndef __LIST_H__ #define __LIST_H__ #include <stdio.h> typedef struct List *ListRef; typedef struct Node *NodeRef; typedef struct Node { long data; NodeRef next; NodeRef prev; } NodeType; typedef struct List { NodeRef first; NodeRef last; NodeRef cur...
C
#undef TYPENAME #undef TYPEID #define TYPEID char #define TYPENAME char #include "../../generics/gvector/gvector.h" #include "gvector_extension.h" #include "../../generics/gvector/gvector.c" #include "gvector_extension.c" #undef TYPENAME #undef TYPEID #define TYPEID int #define TYPENAME int #include "../../gene...
C
/** @file opcontrol.c * @brief File for operator control code * * This file should contain the user operatorControl() function and any functions related to it. * * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/publicdomain/zero/1.0/ * * PROS contains FreeRTOS (http://www.freertos...
C
#include <stdio.h> #include "RobustSR.h" // Sign: Entrega 1 si el valor es mayor a cero, cero si vale cero, y -1 si es negativo /* Inputs: X - A matrix with values Output: The sign of values of inputs */ TipoImagenSR sign(TipoImagenSR X) { TipoImagenSR Y; /* Y = (x > 0) ? 1 : ((x<0) ? -1 : 0) */ ret...
C
//Recursion- Caliing of function itself in 'C' is called recursion. The best example is factorial. #include<stdio.h> int factorial(int a); int main() { int a; printf("Enter the number: "); scanf("%d",&a); printf("The factorial of %d is %d\n",a,factorial(a)); return 0; } int factorial(int ...
C
#include "splaytree.h" Arvore * createArvore(){ //struct No * root; Arvore * nova = malloc(sizeof(Arvore)); nova->root = NULL; return nova; } No * createNo(int info){ /*int info; struct node* esq; struct node* dir; struct node* pai;*/ No * novo = malloc(sizeof(No)); novo->esq = NULL; novo->dir = N...
C
// Chuong trinh dieu khien ON/OFF GPIO2, thoi gian ON/OFF 500ms // Board thu nghiem ESP32 NodeMCU // #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "driver/gpio.h" #define LED_GPIO 2 void blink_task(void *pvParameter) { gpio_set_direction(LED_GPIO, GPIO_MODE_OUTPUT);//Dat chan GPIO2 o che do xuat...