language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include <stdio.h> #include <dlfcn.h> #include <ffi.h> #include <malloc.h> #include <stdlib.h> int main() { //拿函数指针 void *lib_handle = dlopen("./test_return.so", RTLD_NOW|RTLD_GLOBAL); void* functionPtr = dlsym(lib_handle, "testFunc"); int argCount = 2; //按ffi要求组装好参数类型数组 ffi_type **ffiArgTypes = alloca(s...
C
// See LICENSE for license details. #include <stdio.h> #include "hbird_sdk_hal.h" #ifdef SOC_HBIRD #ifdef BOARD_HBIRD_EVAL #define BTN1_GPIO_OFS 30 #define BTN2_GPIO_OFS 31 #define PLIC_BTN1_INT (8+BTN1_GPIO_OFS) #define PLIC_BTN2_INT (8+BTN2_GPIO_OFS) #endif #endif #i...
C
#include <stdio.h> #include <stdlib.h> #include "./models/movie.h" #include "./views/views.h" int main() { int i; int status = 1; // Status del programa /* Collecion de peliculas */ MovieCollection* catalog; catalog = (MovieCollection*) malloc(sizeof(MovieCollection)); catalog->movies = (Movie*) malloc(sizeo...
C
/************************************************************************* > File Name: my_signal.c > Author: Linuxer_liu > Mail: > Created Time: 2017年07月31日 星期一 16时29分54秒 ************************************************************************/ #include<stdio.h> #include<stdlib.h> #include<signal.h> #include<sy...
C
//#define _CRT_SECURE_NO_WARNINGS 1 // //#include <stdio.h> //#include <stdlib.h> //#include <assert.h> //#include <stdbool.h> // //typedef struct Position //{ // int row; // int col; //}pos; // //bool ispass(char** board, char* word, int row, int col, pos next, int k, int len) //{ // if (next.row < row && nex...
C
/* ** my_atoi.c for my_atoi in /home/artha/signal_test ** ** Made by dylan renard ** Login <artha@epitech.net> ** ** Started on Fri Feb 17 12:38:33 2017 dylan renard ** Last update Fri Feb 17 12:52:31 2017 dylan renard */ #include "my.h" int my_atoi(char *nb) { int final; int sign; int i; int j; fi...
C
void LabInfo(){ //Task 1 cout<< "Cian Baynes"<< endl; cout<< "Lab 2"<<endl; } void LabInfo1(int x, int y){ //Task 2 if (x>y){ cout<<"The largest value is "<<x<<endl; } else{ cout<<"The largest value is "<<y<<endl; } } void Numberlarge(){ //Task 3 int num=0; cout<<"\n\nEnter a nu...
C
#include "editor.h" void disable_raw_mode(t_termios orig_termios) { tcsetattr(STDIN_FILENO, TCSAFLUSH, &orig_termios); } t_termios enable_raw_mode(void) { t_termios new_termios; t_termios orig_termios; tcgetattr(STDIN_FILENO, &orig_termios); new_termios = orig_termios; new_termios.c_lflag &= ~(ICANON | ECHO...
C
/* hello-world.c * * time tutorial * https://www.youtube.com/watch?v=Qoed2uBwF_o */ #include <stdio.h> #include <time.h> #include <unistd.h> // Sleep function. int main(int argc, char **argv) { printf("Hello World\n"); // Get time. time_t now = time(NULL); printf("%ld\n", now); // # of seconds since Jan....
C
#pragma once #ifndef FAT_H #define FAT_H #include <stdio.h> #include <stdint.h> #include <assert.h> #include "fat_structure.h" struct fat_data { char *memory; /* pole predstavuje fat disk*/ size_t memory_size; /* velikost pole memory */ struct boot_record *boot_record; /* boot record Fat disku */ uint32_t...
C
#ifndef __ACTIVITY1_H_ #define __ACTIVITY1_H_ /** * @file activity1.h * @author Charanya () * @brief Project to Blink an LED connected to AVR328 MCU GPIO Pin if Push button of the car seat is closed and heater switch is turned ON * @version 0.1 * @date 2021-04-23 * * @copyright Copyright (c) 2021 * */ /** ...
C
#include <stdio.h> #include <stdlib.h> #include "esparsa.h" //KPS void Esparsa_init(TEsparsa *E){ E->inicio=NULL; E->fin=NULL; E->numElem=0; } int Esparsa_isEmpty(TEsparsa *E){ return E->numElem==0; } int Esparsa_length(TEsparsa *E){ return E->numElem; } void Esparsa_insert(TEsparsa *E,int pos,TElemento e){ TNodo...
C
#include <stdio.h> #include <stdlib.h> #include <mpi.h> #include <time.h> #define N 1600 #define P 2 int main(int argc, char* argv[]){ int rank, new_rank, size, new_size, reorder; int buff[(N/P) * (N/P)]; int dims[3], period[3],coords[3], A[3][N][N]; int localMax = 0; int globalMaxR = 0; int g...
C
/* program can be found at: http://www.csl.mtu.edu/cs4411.ck/www/NOTES/process/fork/create.html */ /* fork2.c similiar to fork1.c but uses the sleep command to synchronise the parent and the child */ #include <stdio.h> #include<unistd.h> #include <sys/types.h> #define MAX_COUNT 20 void ChildProcess(vo...
C
/* -- PCF Operating System -- * See [docs\COPYRIGHT.txt] for more info */ /** @file lib\include\libc\internal.h @brief Libc internal use */ #ifndef LIB_INCLUDE_LIBC_INTERNAL_H #define LIB_INCLUDE_LIBC_INTERNAL_H /** @brief Float type struct */ typedef struct { /** @brief Mantissa */ unsigned mantissa:23; ...
C
#include <stdio.h> int min(int, int); int max(int, int); int main() { int n = 0; scanf("%d", &n); for (int i = 0; i < n; i++) { int a = 0; int b = 0; scanf("%d %d", &a, &b); int minv = min(a,b); int maxv = max(a,b); if (minv % 2 == 0) { minv++; } else { minv += 2; } int sum = 0; ...
C
/** * Auteur : Nicolas Levasseur * * Ce programme a ete concu pour tester trois methodes d'integration numeriques * (methode des trapezes, de Simpson et de Simpson 3/8). On a pense a la * modularite du code, donc on utilise pas la fonction exponentielle directement * mais elle est passee en argument aux div...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* possibilite.c :+: :+: :+: ...
C
/*! \file main.c \brief This file is the entry point for paragon's various components \date Started 11/27/09 \author George \version\verbatim $Id: omp_main.c 9585 2011-03-18 16:51:51Z karypis $ \endverbatim */ #include "simdocs.h" #include <pthread.h> #ifndef NTHREADS #define NTHREADS 2 #endif pthread_cond_t...
C
#include <stdio.h> #include<stdlib.h> typedef struct { int data; struct Node* leftchild; struct Node* Rightchild; }Node; Node* initNode(int data, Node* leftchild, Node* Rightchild) { Node* node = (Node*)malloc(sizeof(Node)); node->data = data; node->leftchild = leftchild; node->Rightchild = Rig...
C
/* * Docked - Mains Idle state */ #include <stdio.h> #include <string.h> #include <rob_system.h> #include <task_handler_types.h> #include <state_machine_server.h> #include <shutdown_state.h> #include <docked_charging_state.h> #include <mobile_state.h> #include <docked_mainsidle_state.h> /* * MANIFEST ...
C
#include <stdio.h> int main(){ long long int n,k; long long int num,count; scanf("%lld%lld",&n,&k); count=0; while(n--){ scanf("%lld",&num); if(num%k==0){ count++; } } printf("%lld",count); return 0; }
C
#include <stdio.h> #include "SDL.h" #include "imagen.h" #include "Mugimendua.h" IMG irudiak[MAX_IMG]; int irudiKop = 0; int id = 0; int irudiaKargatu(char* fileName) { int colorkey; SDL_Surface* surface; if (irudiKop < MAX_IMG) { surface = SDL_LoadBMP(fileName); if (surface == NULL) { fprintf(stderr, "Coul...
C
/** * @file lab5_2.c * @brief Визначення чи є число простим * * @author Vasilyazhenko Dmitriy * @date 21-dec-2020 * @version 1.0 */ /** * функція для визначення чи є число простим * * Послідовність дій: * - створення змінних для заданого числа та результату * - процес визначення чи є число прости, за допом...
C
//Mike Carrigan #include <stdio.h> #include <string.h> #include <stdlib.h> int convert_to_hex (char* hex_string1){ int len = strlen(hex_string1); int value=0, placeValue = 1; for(int i = (len-1); i>=0; i--){ char temp = hex_string1[i]; if(temp >= '0' && temp <= '9'){ ...
C
#include "Blaisdell_PA3.h" /********************************************************************************* * Programmer: Marcus Blaisdell * Student ID: 097868639 * Class: CptS 122, Spring 2015; Lab Section 3 * Programming Assignment: * Date: 02/16/2015 * Function: *makeNode * Description: make a new node c...
C
#include "uls.h" static void set_for_back_ground(char foreground, char background); static void set_bits_color(char *perms); static void set_type_color(char *perms); static bool is_executeble(char *perms); void mx_enable_color(char *perms, int flags) { if (!MX_F_ISGU(flags)) { return; } set_type_c...
C
#include <stdio.h> #define MAX 1000 int main() { int plantacao[MAX][MAX]; int lin, col; int m, n; int max; int cur; int i, j, k, l; scanf(" %d %d %d %d", &lin, &col, &m, &n); max = 0; for (i = 0; i < lin; i++) for (j = 0; j < col; j++) scanf(" %d", &(plantacao[...
C
#include<stdio.h> #include<stdlib.h> typedef struct Node* PtrNode; typedef PtrNode List; typedef PtrNode Position; struct Node { int ele; Position next; }; void InitLinkList(List L) { L->ele=0; L->next=NULL; } int IsEmpty(List L) { return L->next==NULL; } Position Find(int x,List L) { Posit...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "huffman.h" static int t_cmp(TreeNode* p1, TreeNode* p2){ return (int)((p1)->count - ( p2)->count); } /** static int t2_cmp(TreeNode* p1, TreeNode* p2){ if ((p1)->count == ((p2)->count)){ if ((p2)->left != NULL || (p2)->right != NULL){ return -...
C
/* * Author: Danielle Tucker * TCSS 371 * Date 7 October 2012 * Assignment 2 Simulating Logic Gates * logic_gate.h includes the function prototypes for logic gates */ #ifndef LOGIC_GATE_H #define LOGIC_GATE_H /** * bit not(bit); * Returns the logical NOT of the bit provided. */ bit not(bit); /** * bit and(bit, bit);...
C
#include "FLOAT.h" FLOAT F_mul_F(FLOAT a, FLOAT b) { int index=0; if(a<0) { a=-a; index++; } if(b<0) { b=-b; index++; } unsigned int a1=(a>>16); unsigned int b0=b&0xffff; unsigned int a0=a&0xffff; unsigned int b1=(b>>16); unsigned int c0=(a0*b0)/0xffff; unsigned int c1=a1*b0+...
C
#ifndef LISTA_H #define LISTA_H #include <stdbool.h> #include <stdlib.h> #include <string.h> typedef struct nodo_lista { char* cliente; size_t visitas; struct nodo_lista* prox; } nodo_lista_t; typedef struct lista { nodo_lista_t* primero; nodo_lista_t* ultimo; size_t largo; } lista_t; typedef struct lista_ite...
C
#include <stdio.h> int main(){ int x1,y1,z1,x2,y2,z2; printf("Enter (x1,y1,z1) &(x2,y2,z2) for vector : xi + yj + zk "); scanf("%d %d %d %d %d %d",&x1,&y1,&z1,&x2,&y2,&z2); printf("Dot product of vectors : %d",x1*x2 + y1*y2 + z1*z2); return 0; }
C
// Room: /d/oldpine/epath2.c inherit ROOM; void create() { set("short", "小石橋"); set("long", @LONG 你現在正站在一座長滿青苔的古橋上,橋下是一條山澗,幾股清泉 在亂石之中向山下奔流,橋北邊不遠處有一個瀑布(waterfall) ,從山 壁上猶如一條白練般垂了下來,瀑布兩旁的石壁十分陡峭,高度和山澗 旁的松林相差了近三、四十丈。 LONG ); set("item_desc", ([ "waterfall": "這個瀑布從數百丈高的山壁上衝激而下,流入一個山澗底的小水潭\n" ",水潭兩邊的石壁垂下許\多的藤蔓(...
C
#include "hash_table.h" #include <stdlib.h> #include <stdio.h> int main(void) { hash_table_t *my_table = htable_init(128); long int i; /* Turn off buffering of the standart output stream */ setvbuf(stdout, NULL, _IONBF, 0); /* Fill our table with 100000 trash elements */ printf("Filling tree with numbers fro...
C
/* Scrivere un programma che chieda all’utente una stringa composta da parentesi aperte e chiuse: (,),[,],{,} e che verifichi se le coppie e l’ordine delle (,),[,],{,} sono corretti. Utilizzare uno stack. */ #include <stdio.h> #include <stdlib.h> #include <stdbool.h> #define MAX 4096 typedef struct nodo{ char val...
C
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<time.h> #include<math.h> #include<ctype.h> const int max_x=61, max_y=31, max_stars=max_x*max_y, max_pairs=max_stars/2; char galaxy[max_y][max_x]; // frame buffer int star_number, pair_number; /********************************************** STRUCTS ******...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> /////////////////////////////////////////////// int porownanie_lancuchow(char *A, char *B) { int i=0; while(A[i]!=NULL || B[i]!=NULL) { if((int)A[i]<(int)B[i]) return 1; if((int)A[i]>(int)B[i]) return 0; i++; ...
C
#include <stdio.h> #include <stdlib.h> #include <limits.h> #define MIN(a,b) (((a)<(b))?(a):(b)) #define MAX(a,b) (((a)>(b))?(a):(b)) #define SIZE 100 typedef struct item { float value, weight; } Item; int compare (const void * a, const void * b) { Item *left = (Item*) a; Item *right = (Item*) b;...
C
#include"string.h" #include"stdio.h" main() { char mot[100]="Tram nam trong coi nguoi ta"; char hai[100]=" Chu tai chu menh kheo la ghet nhau"; char ba[100]="Trai qua mot cuoc be dau"; char bon[100]=" Nhung dieu trong thay ma dau dn long"; clrscr(); printf("\nCau \" %s\". Co chieu dai :%d ky tu ",mot,strle...
C
#include <stdio.h> int main() { int a = 0, flag; int vetor[10], iguais[10]; for (int i = 0; i < 10; i++) { printf("Entre com o elemento %d°: ", i + 1); scanf("%d", &vetor[i]); } for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { flag ...
C
#include <stdlib.h> #include <string.h> #include <stdio.h> #include <sys/types.h> #include <fcntl.h> #include <unistd.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <ctype.h> #include <stdbool.h> #include <stdarg.h> #include <sys/time.h> #include <limits.h> #include <er...
C
# include<stdio.h> struct node{ int data; struct node *next; }; void append(struct node** head_ref, int new_data){ struct node* new_node = (struct node*) malloc(sizeof(struct node)); struct node *last = *head_ref; new_node->data= new_data; new_node->next=NULL; if(*head_ref==NULL) { *head_ref =...
C
#include <string> #include <iostream> std::string plus(std::string s1, std::string s2) { int len1 = s1.length(), len2 = s2.length(); int pre = 0, temp; std::string ans = ""; for (int i = len1 - 1, j = len2 - 1; i >= 0 || j >= 0 || pre; i--, j--) { if (i >= 0 && j >= 0) { temp = (s1[...
C
#include "hello.h" GtkWidget *janela; GtkWidget *conteiner; GtkWidget *botao; GtkWidget *rotulo; lista * lista_de_textos; void hello (void){ // Muando o texto do rotulo mudar_rotulo(rotulo, lista_de_textos->texto); // Mudando o texto atual para o proximo da lista lista_de_textos = lista_de_textos->...
C
#include "shell.h" /** * _strcat - concatenate two strings * @dest: string to be appended to * @src: string to append * Return: concatenated string */ char *_strcat(char *dest, char *src) { int len = 0; int len2 = 0; int total_len = 0; int j = 0; /* find total length of both strings to _realloc */ while (dest[...
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 "bundle7/bundle7.h" #include "bundle7/eid.h" #include "upcn/bundle.h" #include "cbor.h" #include <assert.h> #include <inttypes.h> #include <stddef.h> #include <stdio.h> #include <stdlib.h> #include <string.h> // -------------------------------- // Endpoint Identifier (EID) Parser // ----------------------...
C
#include <math.h> #include <stdlib.h> #include <assert.h> #include "polygon.h" typedef struct polygon { List *points; Vector *velocity; double red; double green; double blue; } Polygon; Polygon *polygon_init(List *points, Vector *start_vel, double red, double green, double blue) { Polygon *polygon = mallo...
C
/*-*- mode:c;indent-tabs-mode:t;c-basic-offset:8;tab-width:8;coding:utf-8 -*-│ │vi: set et ft=c ts=8 tw=8 fenc=utf-8 :vi│ ╚──────────────────────────────────────────────────────────────────────────────╝ │ ...
C
/* ** EPITECH PROJECT, 2018 ** n4s.c ** File description: ** algo etc */ #include <string.h> #include <stdlib.h> #include "my.h" static void print_n_reset(char *str) { my_putstr(str); str = get_next_line(0); } static void algo(float weel_rotate_left, float weel_rotate_right) { float weel_rotate; if ...
C
#include "MenusAndErrPresenters.h" #include "../services/MVPutils.h" /*** menus PHEs ***/ /* generalMenuPHE is the PHE function used for all the menus of the program * (both simple and complex menus. it gets the menu model, view state, an array of states representing * the state the button number leads to, number o...
C
/* ** EPITECH PROJECT, 2019 ** strace ** File description: ** print_regs.c */ #include "strace.h" void print_regs(long long int syscallnb, struct user_regs_struct regs) { print_name(syscallnb, regs); print_params(syscallnb, regs); print_retval(regs); } void print_name(long long int syscallnb, struct user...
C
/******************************************************************************* * Company: * * Project: GPS frequency standard * * Description: conversion functions for raw byte arrays <-> number formats * * Filename: convert.h * * Author: Tobias Plüss <tpluess@ieee.org> * * Creation...
C
#include <sys/ipc.h> #include <sys/shm.h> #include <pthread.h> #include <signal.h> #include "TimeFunc.h" //#define SIZE 1000 //////////////////////////////////Global Var/////////////////////////// int *washedcars; int *machine; double *timeWash; int *flag; pthread_mutex_t mutex; pthread_cond_t IsMachine; struct timev...
C
#include<unistd.h> #include<stdlib.h> #include<stdio.h> #include<string.h> #include<sys/types.h> #include<sys/ipc.h> #include<sys/sem.h> #include<sys/msg.h> #include<pthread.h> /* * Without tools we do not know what thread is accessing what * I would like to use mutex but this is suppose to show * why we need to...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/io.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <termios.h> #include <stdio.h> #include "mex.h" /* % setparallel(port, byte) % % port: number of parallel port (1, 2, 3). % NOTE: parallel port bases used are ma...
C
#include <stdio.h> #include <unistd.h> void a() { extern int count; count++; } void b() { extern int count; count++; } void c() { extern int count; count++; } int count; int main() { a(); b(); c(); b(); printf("count = %d\n", count); pause(); return 0; }
C
#include <stdio.h> typedef struct { int row; int col; } pt; typedef struct { pt pt1, pt2; } rect; int area(const rect *p_rect){ int area = (p_rect -> pt1.row - p_rect -> pt2.row) * (p_rect -> pt1.col - p_rect -> pt2.col); return area >= 0 ? area : 0 - area; } int main(){ rect r1 = {}; printf("Enter a rec...
C
/* ** EPITECH PROJECT, 2018 ** libmy ** File description: ** strdup.c */ #include "my/string.h" char *my_strdup(const char *src) { size_t len = my_strlen(src); char *dest = my_calloc(len + 1, sizeof(char)); if (dest != NULL) dest = my_strncpy(dest, src, len); return (dest); } char *my_strndup(const char *src,...
C
#include<stdio.h> int main() { int n,k; scanf("%d %d",&n,&k); int i; int a[100001]; int s[100001]={0},ans,x; for(i=0;i<n;i++) { scanf("%d",&a[i]); int x=(i+1)%k; s[x]+=a[i]; } int min=1111111111; for(i=1;i<k;i++) { if(min>s[i]) { ...
C
#include <stdio.h> #include <string.h> char nibbletochar(char c) { if (c >= '0' && c <= '9') return c - '0'; if (c >= 'a' && c <= 'f') return c - 'a' + 10; if (c >= 'A' && c <= 'F') return c - 'A' + 10; return 255; } int main(int argv, char *argc[]) { unsigned int i, j; if (argv != 2) return 1; j = ...
C
/* Authors: W. R. Stevens, B. Fenner, A. M. Rudoff */ #include "unpifi.h" int main(int argc, char **argv) { int n; char ifname[IFNAMSIZ]; struct if_nameindex *ifptr, *save; if (argc != 1) err_quit("usage: prifnameindex"); /* print all the interface names and indexes */ for (save = ifptr = If_nameind...
C
#include <stdio.h> int main() { int i, n, result; printf("n의 값을 입력하시오: "); scanf("%d", &n); result = 0; for(i = 0 ; i < n ; i++) { result += (i + 1) * (i + 1); } printf("계산한 값은 %d입니다.\n", result); return 0; }
C
/* Q1. Write a menu driven program to do the following on single linked list :- a. Reverse the linked list using change of the address (Change the link/next of each node) b. Reverse the list by changing the value (Use stack)*/ //------------------------ CODE ------------------------------------------...
C
#pragma once #include "Basic.h" // Directed Graph typedef int T ; // Template for understanding typedef struct Vertex { T m_Data ; bool m_bVisit ; int m_iIndex ; struct Vertex * m_pNext ; struct Edge * m_pAdjacencyList ; // Point Edges that connected with current Verte...
C
#include "main.h" #include <unistd.h> /** * print_square - functions to print a square * @size: the size of the square * * Return: void */ void print_square(int size) { int j = size; int i; if (size <= 0) _putchar('\n'); else while (size > 0) { for (i = 0; i < j; i++) { _putchar('#'); } ...
C
/* ************************************************************************** */ /* LE - / */ /* / */ /* get_next_line.c .:: .:/ . .:: ...
C
#include <inc/x86.h> #include <inc/pmap.h> void notbusy(void) { while(inb(0x1F7) & 0x80); // wait for disk not busy } void readsect(u_char *dst, u_int count, u_int offset) { notbusy(); outb(0x1F2, count); outb(0x1F3, offset); outb(0x1F4, offset>>8); outb(0x1F5, ...
C
#include<stdio.h> #include<string.h> int main() { int n; printf("\nEnter the greatest number in pattern "); scanf("%d",&n); int a[n]; for(int m=0;m<n;m++) { a[m] = n-m; } int i,j,k,l; for( i=0;i<n;i++) { for( j=0;j<n-i;j++) { print...
C
#include <sys/syscall.h> #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #define __NR_ptreecall 356 struct prinfo { pid_t parent_pid; /* process id of parent, set 0 if it has no parent*/ pid_t pid; /* process id */ pid_t first_child_pid; /* pid of youngest child, set 0 if it has no chi...
C
#ifndef OBJ_CONT_INCLUDED #define OBJ_CONT_INCLUDED /* cont - continuation object */ #include "cv.h" #include "mem_mixvec.h" /* * Eventually, there may be multiple sizes of continuations, with * different numbers of saved values. The functions below with prefix * "cont_" operate on any continuation. The ones pr...
C
#include <stdio.h> char *ft_strcapitalize(char *str); int main(void) { char str1[] = "oi, tudo bem? 42palavras quarenta-e-duas; cinquenta+e+um"; printf ("Antes: %s\n", str1); printf ("Depois: %s\n", ft_strcapitalize (str1)); return (0); }
C
#include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <string.h> #include <time.h> //#define rok 2011 int rok; bool popraw=false; #define DEBUG /* Zadeklarować strukturę Pracownik o polach przechowujących: imię, nazwisko, stanowisko, staż pracy, rok urodzenia i miejsce urodzenia. Napisać: X funkcję po...
C
#include <stdio.h> #include <time.h> #define MILLION 1000000L #define THOUSAND 1000 void function_to_time(void); int main(void) { long diftime; struct itimerspec nvalue, ovalue; timer_t timeid; if (timer_create(CLOCK_REALTIME, NULL, &timeid) == -1) { perror("Failed to create a timer based on CLOCK_...
C
#include<stdio.h> void main(){ printf("print prime numbers ranging between 1 to 50:\n"); int count,j; for(int i=2; i<=50; i++){ count=0; j=1; while(j<=i/2){ if(i%j==0) count++; j++; } if(count==1) printf("%d\t",i); } printf("\n"); }
C
#include <stdio.h> int main() { int n; printf("do koe chiso?: "); scanf("%d", &n); for(int i=0;i<=n;i+=2) printf("%d\n", i); return 0; }
C
#include <stdio.h> #include <sys/socket.h> #include <string.h> #include <unistd.h> #include <arpa/inet.h> const int PORT = 8080; const int BUFFER_SIZE = 131072; int main() { int sockfd, n; struct sockaddr_in serv_addr; struct hostent *server; char buffer[BUFFER_SIZE]; sockfd = socket(AF_INET, SO...
C
// O(n^2) // Insert_Sort void print_arr(int *, int); void insert_sort(int *, int); int main(){ int arr[10]= {9,5,8,1,3,4,2,7,6,10}; printf("before insert sorting\n"); print_arr(arr, sizeof(arr)/sizeof(int)); insert_sort(arr, sizeof(arr)/ sizeof(int)); printf("after insert sorting\n"); pri...
C
#include <stdio.h> #include <stdlib.h> #include <SDL/SDL.h> #include "graphics/SDLCheck.h" #include "game/variableManagement.h" #include "graphics/game/graphicGame.h" #include "graphics/button.h" #include "game/game.h" Card_t graphicPlayerCardChoice(Card_t player_hand[8], Card_t table_cards[4], SDL_Surface *screen, ...
C
#include "holberton.h" /** * factorial - Textbook example of using recursion through factorials. * @n: Parameter of given number that is used for factoring. * * Description: Two base cases where if n is negative and n gets to 1. * Description (cont): Otherwise, keep getting the factorial. * * Return: -1, 1, n ...
C
#include <stdio.h> // old project from 2016 #define INCOMETAX .125 #define FEDERALTAX .25 #define STATETAX .10 #define RETIREMENT .08 void calculatePayroll(int *s, int *b); void printPayroll(int *x, int *y, float, float, float, float, float, float); int main() { int sales, bonus; fputs("Please enter the tot...
C
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /* * File: main.c * Author: Vitor * * Created on 3 de Julho de 2018, 14:10 */ /* * */ #include <stdio.h> #include <stdlib....
C
/* -- IFJ project 2013 ------------------------------------------------------ ** ** Interpreter of IFJ2013 language ** 4.11.2013 - 15.12.2013 ** ** Team 13 (b/3/I): ** ** Bank Tomáš <xbankt00@stud.fit.vutbr.cz> ** Birger Mark <xbirge00@stud.fit.vutbr.cz> ** Botka Roland <xbotka00@stud.fit.vutbr.cz> ** +Brandejs Zd...
C
/* ** EPITECH PROJECT, 2019 ** PSU_tetris_2019 ** File description: ** fct_flag.c */ #include "tetris.h" int key_left(key_p *key, char *str) { int new_key = recup_char_key(str); if (new_key == -1) { my_printf("Bad input for key left\n"); exit (84); } else key->left = new_key; ...
C
#include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include <stdio.h> #include <fcntl.h> char name[] = "large.dat"; int main(int argc, char* argv[]) { int f; char data = (char)0; /* not null! 0s. */ /* create / write the file given */ f = open(name, O_CREAT | O_WRONLY, 0666); write(f, &data, 1);...
C
#include "main.h" extern unsigned char data[9]; unsigned char Reset_1_Wire() { unsigned char status; bis(_1_WIRE_DIR, DQ); bic(_1_WIRE_OUT, DQ); __delay_cycles(480); //obtain about 480us bic(_1_WIRE_DIR, DQ); //release about 60us __delay_cycles(60); //60us status = check_bit(_1_WIRE_IN, DQ); //DS18B20...
C
#ifndef STRING_H #define STRING_H #include "../DataStructureBase.h" typedef struct { char *ch; //储存字符串,使用动态分配 int len; //存储字符串长度 }HString; Status InitStr(HString *str); //初始化str为空串 Status DestroyStr(HString *str); //销毁串str Status StrAssign(HString *str1, char *str2); //生成一个其值等于str2的串str1 Status StrCopy(HString *...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "LinkedList.h" #include "pelicula.h" #include "parser.h" #include "utn.h" int controller_listExist(LinkedList* pArrayListeDominio) { int existe = -1; if(ll_len(pArrayListeDominio)>0) { existe = 1; } return existe; } int...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "symbol_table.h" table *tableptr; void push(char * name, char type) { table * last = NULL; // Assign identifier values to the new struct table * new = malloc(sizeof(table)); new -> id = name; new -> type = type; new -> next = NULL; if...
C
/* * extension.h * A GTK+ interpreter for the LOGO language * * Author: Kenneth Kam <kk4053@bris.ac.uk> * Username: kk4053 * Declaration: This code for COMSM1201 is the original work of Kenneth Kam. */ #include <gtk/gtk.h> // linked list of Logo inputs struct _input_items { Logo input; gchar *buff...
C
#include<stdio.h> #include<conio.h> #include<windows.h> #include<stdlib.h> void gotoxy(int x,int y) { COORD c; c.X=x; c.Y=y; SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),c); } void main() { int h=0,m=0,s=0; int a=20,b=8; int ch; double i; system("color 1a"); printf("enter the H...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strncmp.c :+: :+: :+: ...
C
/* Macro to calculate offset of variable in a structure. Let the base address to be zero, then the member's addresses are exactly their offset in this structure. Tested on gcc. */ #include <stdio.h> #define offsetof(s, m) (size_t)(&(((s *)0)->m)) typedef struct _aa { int a; int b; int c; } aa...
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
/* * NxM Mixer * * * The algorithm inplements generic NxM mixer * * N * --- * \ * y[i] = > a[i][j] * x[j] * / * --- * j=1 * * i = 1,2,3,...,M */ #define BLOCK_SIZE 16 #define N 16 // max number of input channels #define M 16 // max number of output channels ...
C
/************************************************************************** Copyright(C), 2016-2026, tao.jing All rights reserved ************************************************************************** File : dvl_data_process.c Author : tao.jing Date : 19-9-6 Brief : *****************...
C
/*=============== * 静态链表去重 * * 包含算法: 2.17 ================*/ #include "Difference.h" /* * ████████ 算法2.17 ████████ * * S = (A-B)∪(B-A) * * 对集合A和集合B进行(A-B)∪(B-A)计算,计算结果存入静态链表S * * *【备注】 * * 教材中默认从控制台读取数据。 * 这里为了方便测试,避免每次运行都手动输入数据, * 因而允许选择从预设的文件path中读取测试数据。 * * 如果需要从控制台读取数据,则path为NULL或者为空串, * 如果需要从文...
C
#ifndef RYAN_CS_H_ #define RYAN_CS_H_ #include "ryan_s.c" #endif /* RYAN_CS_H_ */ #define MAX 1024 int main(int argc, char** argv) { int listenfd, connfd; char rev[100],sendline[MAX]; int max = 100, rev_len; if(argc < 2){ printf("usage: ./s <port>\n"); return 0; } listenfd = ryan_server_start(atoi(argv[1]), 1...