language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
/* lists.h -*- mode:c; coding:utf-8; -*- * * Copyright (c) 2010-2021 Takashi Kato <ktakashi@ymail.com> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redi...
C
#pragma once #include "LinearAlgebra.h" // 󸡵ƽ inline double square(double x) { return x * x; } // ʾĽṹ struct ClosedInterval { ClosedInterval(double x) : left(x), right(x) {} ClosedInterval(double left, double right) : left(left), right(right) { #ifdef _DEBUG if (left > right) throw "߲ܱ...
C
#include <stdio.h> int main () { printf("Detta program räknar ut vilka tal som är burrtal, dvs. tal som innehåller en viss siffra eller är jämt delbar med den. Ange önskad burrsiffra:\n"); int burrsiffra; scanf("%d", &burrsiffra); int j; for (j = 1; j < 100; j++){ if (j % burrsiffra == 0){ ...
C
#include<stdio.h> int main(void) { int a , b , soma , parcial , resultado; a = 0; b = 1; soma = 0; resultado = 0; while(soma <= 4000000){ a = b; b = soma; parcial = soma; if(soma % 2 ==0) resultado += parcial; soma = a + b; } printf("A soma de todos os elementos da serie de fibonnaci menor que 4...
C
#include<stdio.h> //将数字转化为二进制方法 int main() { int a,j,i,m,n; int s[6]; a=0; for(;a<64;a++) { i=a%2,j=a/2; for(m=0;m<6;m++) { s[m]=i; i=j%2,j=j/2; } for(n=5;n>=0;n--) { printf("%d",s[n]); } printf("\n"...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* buffer.c :+: :+: :+: ...
C
/* ** my_atoi.c for raytracer1 in /home/Cyriack/Projects/MUL_2016/lol/raytracer1/raytracer1/raytracer1 ** ** Made by Lucas Le Ray ** Login <Cyriack@epitech.net> ** ** Started on Sun Mar 19 21:16:48 2017 Lucas Le Ray ** Last update Sun May 28 22:01:42 2017 Thery Fouchter */ #include "raytracer.h" float my_atof(ch...
C
#include <stdio.h> #include <stdlib.h> int main (int argc, char** argv) { char character; printf("Entrez un caractere svp "); scanf("%c", &character); printf("%d", character); return 0; }
C
#include "lexer.h" char *stringLiterals[stringLiteralsSize] = {NULL}; int nowStringLiteralsNum = 0; char checkSingleletterReserved(char p) { // Punctutor. static char spuncts[] = {'+', '-', '*', '/', '>', '<', ';', '=', '(', ')', '[', ']', '{', '}', ',', '&', '"'}; for(int i = 0; i < sizeof(spuncts) / sizeof(char)...
C
#include <stdio.h> int main() { printf("abcdefg" "1234567\n"); /* 1. output: abcdefg1234567 2. notes: 若 printf 中的两个字符串如上相连(不加逗号),输出时会连起来 */ printf("abcdefg\ 1234567\n"); /* 1. output: abcdefg 1234567 2. notes: 若 printf 中一对双引号内的字符串要换行,可加上反斜杠 ...
C
#include <windows.h> #include <winioctl.h> #include <stdio.h> #include <ftapi.h> void __cdecl main( int argc, char** argv ) { TCHAR dosDriveName[10]; HANDLE h; BOOL b; PARTITION_INFORMATION partInfo; DWORD bytes;...
C
#include <fcntl.h> #include <stdio.h> #include <sys/stat.h> #include <sys/mman.h> #include <stdlib.h> #include <assert.h> #include <string.h> #include <zconf.h> // // Created by Pavel on 31/10/2018. // int main(){ char* new_string = "This is a nice day"; int fd = open("/Users/Pavel/programs/OSs/git/week11/ex1....
C
/* Wil Deering, November 12 2018, CSCI 2132, A5 This program takes in a specified number of strings of digits, and checks to see if the string passes Luhn's checksum, printing whether it does or not */ #include <stdio.h> int luhn_checksum(int len, int a[]); int main(){ int trials,i; scanf("%d",&trials); getchar...
C
/* * PIC.c * * Created on: 14.07.2012 * Author: pascal */ #include "pic.h" #include "util.h" #include "display.h" //Master #define PIC_MASTER_COMMAND 0x20 #define PIC_MASTER_DATA 0x21 #define PIC_MASTER_IMR 0x21 //Slave #define PIC_SLAVE_COMMAND 0xA0 #define PIC_SLAVE_DATA 0xA1 #define PIC_SLAVE_IMR 0...
C
#ifndef MERGE_H #define MERGE_H #include <fcntl.h> #include <math.h> #include <pthread.h> #include <stdio.h> #include <stdlib.h> #include <sys/stat.h> #include <sys/types.h> #include <sys/wait.h> #include <time.h> #include <unistd.h> #define THREAD_MAX 4 // maximum number of threads depending upon cores #define PROCE...
C
//Tyler Watson 260867260 #include <stdio.h> #include <stdlib.h> #include <ctype.h> int main(int argc, char **argv) { int size; //initialize size variable if (argc > 1) { //true if there are arguments with the script command if (atoi(argv[1]) <= 0) { //check if arg is greater than 0 printf("%s", "An i...
C
#include<stdio.h> struct data{ /*structure containing data of students*/ char name[100]; char roll_no[100]; int age; int marks; }; int main() { int n; scanf("%d\n", &n); /*input the number of students*/ struct data array[n]; /*array of structure*/ for(int i = 0; i < n; i++) /*input the details of students*/ { ...
C
#include <stdio.h> #include <unistd.h> #include <stdlib.h> /* abort 函数:给自己发送异常终止信号 6) SIGABRT 信号,终止并产生core文件 void abort(void); 该函数无返回 */ int main() { printf("当前进程pid=%d\r\n", getpid()); abort(); return 0; }
C
#include "lists.h" #include <string.h> /** * *add_dnodeint - adds a node to a linked list head * @head: linked list head * @n: int element of the linked list * Return: number of elements */ dlistint_t *add_dnodeint(dlistint_t **head, const int n) { dlistint_t *new_node; new_node = malloc(sizeof(dlistint_t)); ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* sh_perror.c :+: :+: :+: ...
C
#include "CommandsPm.h" #include "String.h" #include "LinkedList.h" #include "HashTable.h" #include "Object.h" #include "Pessoa.h" #include "Quadra.h" #include "Endereco.h" #include <stdio.h> void commandInsertPessoa( Cidade *cidade, char *line ){ char cpf[STRING_SIZE], nome[STRING_SIZE], sobrenome[STRING_SIZE], sexo...
C
struct strt { int Length; }; int main() { struct strt *acts = (struct strt *)malloc(sizeof(struct strt)); acts->Length = 3; struct strt *act_implicit = &*acts; act_implicit->Length = 4; struct strt temp = *acts; struct strt *act_explicit = &temp; act_explicit->Length = 5; sparrow_print(acts); sp...
C
#ifndef MYREADELF_H #define MYREADELF_H /*-----------------------------------------------------------------*/ #include "myreadelf_module.h" /*-----------------------------------------------------------------*/ enum flag_num{ FLAG_H, FLAG__help, FLAG_h, FLAG__file_header, FLAG_x, FLAG__hex_dump, FLAG_FILE }; // typedef ...
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: power.c * Author: Simply Enoch * * Created on October 21, 2019, 8:37 AM */ #include <stdio.h> #include <stdlib.h> ...
C
#include <stdio.h> typedef struct listas { int info; struct listas *next; } Lista_t; Lista_t * InsCodaCrea(Lista_t *t,int num); Lista_t * InsTesta(Lista_t *t, Lista_t *n); Lista_t * InvertiLista(Lista_t *t); void StampaLista(Lista_t *t); int main() { Lista_t *testa = NULL; Lista_t *n...
C
#include <stdio.h> int main() { char a; char t, T; int f=0; while(1) { scanf("%c", &a); if(a=='*') {break;} if(a<95) { T=a; t=a+32; } else { T=a-32; t=a; } while(1) { scanf("%c", &a); if(a=='\n') {break;} else if(a==' ') { scanf("%c", &a); if((a!=t) &&...
C
/* ************************************************************************** */ /* */ /* :::::::: */ /* ft_itoa.c :+: :+: ...
C
#include <stdlib.h> #include <stdio.h> #include <poll.h> #include <ctype.h> #include <unist.ih> #include "mbconsole.h" // TODO? uint32_t* argv[]) int extra_debug = 0; void exe_test(uint32_t argc, char* argv[]){ printf("TEST OK\n"); } void exe_parse(uint32_t argc, char* argv[]){ printf("Parsed %d args\n", argc); f...
C
/* * All memory allocation functions are here */ #include <stdlib.h> #include <stdbool.h> #include <stddef.h> #include <stdalign.h> #include <string.h> #include <kernel/mm.h> #include <kernel/sched.h> #include <kernel/sync.h> #include <kernel/panic.h> #define CANARY 0xCAFEBABE /* Chunck anatomy: * * chunck_mar...
C
#include <stdio.h> int main(void) { int n = 0, n2 = 0; printf("TABLE OF MULTIPLES OF 5 AND THEIR TRIANGULAR NUMBERS\n\n"); printf(" M TN \n"); printf("--- ----\n"); while(n % 5 == 0, n <= 50) { n2 = n * (n + 1) / 2; printf("%2i %i\n", n, n2); ...
C
#ifndef POSITION_H #define POSITION_H struct Position { int x, y; bool operator<(const Position &position) const; bool operator==(const Position &position) const; Position operator+(const Position &position) const; Position operator-(const Position &position) const; }; #endif
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <conio.h> #include <ctype.h> #include "proveedores.h" #include "productos.h" #include "informes.h" #include "input.h" void ordenarProd(eProducto prod[], int cantidad) { int j, k; eProducto aux; for (j=0; j<cantidad-1; j++) ...
C
// //////////////////////////////////////////////////////////////// // // Project: Pipes in Unix // Author: Christopher Anzalone // File: pipes.c // // \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ // // Description: // // The pipes program replicates the behavior of the pipes // command (|) in a ...
C
#ifndef __FAMILY_TREE_H #define __FAMILY_TREE_H #include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h> #ifdef __cplusplus extern "C" { #endif #ifdef __GNUC__ #pragma GCC diagnostic ignored "-Wpragmas" #pragma GCC diagnostic ignored "-Wunknown-pragmas" #pragma GCC diagnostic ignored "-pedantic...
C
/************************************************************************************************** * * File Name: id_node.h * * Author: Reed Terdal * * Created for CS344 on: 10/09/2019 * * Purpose: Header that provides access to functions for manipulating ID nodes. * ***************************************************...
C
#include "holberton.h" #include <stdlib.h> /** * _strdup - function that returns a pointer to a newly allocated space in * memory, which contains a copy of the string given as a parameter. *@str : array. * Return: pointer to a new string , NULL if str = NULL , on success eturns a * pointer to the duplicated stri...
C
/// file: mirsa_genkeys.c /// description: /// reads commandline arguments and checks the flag and returns messages based on the commandline ///and it creates random prime numbers and pass it to the function in mirsa_lib.h to create oup and pvt keys as well as files for those keys /// ////// author: Gayathri Kanaga...
C
#include <stdio.h> #include <stdlib.h> #define SIZE 1024*1024*300 int main(void) { int temp1, temp2; int *arr = (int *)malloc((SIZE)*sizeof(int)); int i = SIZE; temp1 = clock(); for (; i > 0; --i) { arr[i] = i; } temp2 = clock(); printf("elapsed = %d\n", temp2-temp1); } ...
C
/******************************************************************************* * Copyright (C) 2020 Dale Alleshouse (AKA Hideous Humpback Freak) * dale@alleshouse.net https://hideoushumpbackfreak.com/ * * This file is subject to the terms and conditions defined in the 'LICENSE' * file, which is part of this sou...
C
#include "syscall.h" void printhex(int a); int main(int argc, char *argv[]) { char *temp; int i; enableInterrupts(); printString("Printing arguments:\n\r"); temp = "argc: 0\n\r"; temp[6] += argc; printString(temp); temp = "argv[0]: "; for (i = 0; i < argc; i++) { temp[5] = 0x30 + i; print...
C
#define _CRT_SECURE_NO_WARNINGS 1 //#include<stdio.h> // ////int fib(int x)//ʹõݹЧʹڵʱӦȡ ѭķʽ ////{ //// if(x==1||x==2) //// return 1; //// else //// return fib(x-1)+fib(x-2); ////} //int fib(int n) //{ // int a = 1; // int b = 1; // int c = 1; // while(n>2) // { // c = a+b; // a = b; // b = c; ...
C
/* Дефинирайте пойнтер и опитайте да отпечатате стойността му на конзолата (%р) с printf. Какво се визуализира? */ #include <stdio.h> int main(){ int * pi; printf("%p\n", pi); // prints the address of the pointer itself return 0; }
C
#include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include "binary_tree.h" binary_tree* new_binary_tree() { // Allocate memory for a new binary tree binary_tree* t = (binary_tree*) malloc(sizeof(binary_tree)); t->size = 0; return t; } node* new_node() { node* n = (node*) malloc(sizeof(n...
C
/****************************************************************************** * Filename: ts_length.c * Created on: Mar 8, 2010 * Author: jeremiah * Description: 打印TS各PID的时间长度 * ******************************************************************************/ #include <stdio....
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "skip.h" #define MAX_SIZE 3 #define MAX2 2 void skip(char *x, int m, char *y, int n) { int i, j; List ptr, z[ASIZE]; printf("skip start\n"); memset(z, 0, ASIZE * sizeof(List)); for (i = 0; i < m; i++) { ptr = malloc(sizeo...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* hash_table_api.c :+: :+: :+: ...
C
#include <stdio.h> #include<limits.h> int main() { int i, j, a, n, k[20]; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d", &k[i]); } for (i = 0; i < n; i++) { for (j = i + 1; j < n; j++) { if (k[i] > k[j]) a = k[i]; ...
C
#include <stdio.h> #include <stdlib.h> void swap(int *, int *); int main(int argc, char *argv[]) { int a = 10, b = 20; printf ("main()主函式呼叫swap()函式前,a位址的內容(%x)=%d\n", &a, a); printf ("main()主函式呼叫swap()函式前,b位址的內容(%x)=%d\n", &b, b); swap(&a, &b); printf ("回main()後,a位址的內容(%x)=%d\n", &a, a); printf ("回main()後,b位址的內容(...
C
#include<stdio.h> #include<conio.h> int main() { int n,i,a[100]; for(i=0;i<10;i++) { scanf("%d",&a[i]); } n=a[0]; for(i=0;i<10;i++) { if(a[i]>n) n=a[i]; } printf("%d is greatest",n); getch(); return 0; }
C
#include <stdio.h> #include <stdlib.h> //ʵ #define MAXSIZE 100 typedef int ElemType; typedef int Status; typedef struct SNode { ElemType Data[MAXSIZE]; int Top ; }*Stack; //ѹջ void Push(Stack PtrS,ElemType item) { if(PtrS->Top == MAXSIZE - 1) { printf("ջ\n"); return ; } el...
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
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* printf_conv.c :+: :+: :+: ...
C
#include <stdio.h> #define hasNulByte(x) ((x - 0x01010101) & ~x & 0x80808080) #define SW (sizeof (int) / sizeof (char)) int xstrlen (const char *s) { const char *p; int d; p = s - 1; do { p++; if ((((int) p) & (SW - 1)) == 0) { do { d = *((int *) p); ...
C
/* * Simple app to read/write into a custom IP in PL via /dev/mem physical memory * interface ( Based on Kjans Tsotnep's app ) * To compile for arm: make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- */ #include <stdio.h> #include <stdlib.h> //standard lib #include <unistd.h> //to get pagesize #include <fcntl.h...
C
#include <stdio.h> #include <stdlib.h> //Bài tập 20: Nhập tháng và hiển thị số ngày tương ứng //Yêu cầu bài tập C này là nhập một tháng bất kỳ trong năm và sau đó hiển thị số ngày trong tháng đó int main() { int thang; printf("nhap thang trong nam: "); scanf("%d",&thang); switch (thang) { ...
C
/* Chris Nutter * Austin Kim * * Programming Assignment 3 * CPSC 351-04 */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <pthread.h> // mutex pthread_mutex_t mutex; // Linked list node typedef int value_t; typedef struct Node { value_t data; struct Node *next; } StackNode; // Stack fun...
C
#include <stdio.h> int main() { char as[] = "\\0\0"; int i = 0; do { switch(as[i++]) { printf("%d\n",sizeof(++i)); / /* This statement will never get executed because cases are actually jump labels like go to labels. So this line is skipped and we go directly to the appropriate case label....
C
/* ** get_args.c for minishell1 in /home/manass_j/rendu/PSU_2015_minishell1 ** ** Made by jonathan manassen ** Login <manass_j@epitech.net> ** ** Started on Fri Jan 15 13:01:06 2016 jonathan manassen ** Last update Sat Jun 4 17:36:34 2016 jonathan manassen */ #include <stdlib.h> #include "my.h" #include "./inclu...
C
#include<stdio.h> #include<stdlib.h> int a(int n){ int i,f=0; if(n==2) return 1; for (i=2;i<n;i++){ f+=(n%i==0); } if(f==0) return 1; else return 0; } int main(){ int n; scanf("%d",&n); n++; while(a(n)!=1){ n++; } printf("%d",n); system("PAUSE"); return 0;}
C
#include <stdio.h> #include <stdlib.h> #include <conio.h> #include <windows.h> #include <math.h> void contur_1(double R1, double R2, double L, double C, double W); void contur_2(double R1, double R2, double L, double C, double W); void contur_3(double R1, double R2, double L, double C, double W); void contur_4(double ...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> #include <sys/types.h> #include <unistd.h> #include <signal.h> struct tms { clock_t tms_utime; /* user time */ clock_t tms_stime; /* system time */ clock_t tms_cutime; /* user time of children */ clock_t tms_cstime; /* system time o...
C
/* * * CATDSP * * Opens the the sound card (ie. /dev/dsp) sets the sample rate and * sends audio out to STDOUT. * * Copyright (C) 2000 Timothy Pozar pozar@lns.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * ...
C
/* query.h Header file for the query engine Project name: Tiny Search Engine Component name: Query This file contains functin declarations for query.c Primary Author: Kevin Farmer Date Created: 5/18/15 ======================================================================*/ #ifndef QUERY_H #define QUERY_H ...
C
#include <stdio.h> #include <stdlib.h> int multiply ( int a, int b) { return (a*b); } void afficherlettre (char*prenom) { printf("coucou %s", prenom); int nb1= 2; int nb2= 3; int result= multiply (nb1, nb2); printf("%d,",result); }
C
#include <stdio.h> /* main() c, k state = out while c = getchar != EOF if state == in if c == * if k = getchar == / state = out remove c, k else remove c else if char == \ putchar c = getchar putchar continue ...
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
/* 1. Write a program which accept N number from user and increase by 1 if it is divisible by 3 and increase by 2 if it is divisible by 3 and 5. Input : 12 3 65 15 3 30 Output : 13 4 1 17 4 32 */ void Increase(int *, int); void Display(int *,int);
C
/** drive.c * * A simple program to drive the create using the keyboard. * * Author: Nathan Sprague * * * This file is part of COIL. * * COIL 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 Fou...
C
/* ** EPITECH PROJECT, 2018 ** my_printf.c ** File description: ** Recode my_printf function (see man 3 printf) */ #include <stdarg.h> #include <stdlib.h> #include "my_printf.h" #include "my.h" #include "./utils/flags.h" #include "./handle_args/parse_redirect.h" int my_printf(char const *src, ...) { va_list args;...
C
#include "log.h" #include "structs.h" #include <psp2/kernel/clib.h> #define println(fmt, ...) sceClibPrintf(fmt"\n",##__VA_ARGS__) #define println_vec3(fmt, vec3) sceClibPrintf(fmt); log_Vec3(vec3); sceClibPrintf("\n") #define println_vec4(fmt, vec4) sceClibPrintf(fmt); log_Vec4(vec4); sceClibPrintf("\n") /** * @bri...
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
/* * This file defines six functions that support the optional printing * of debugging messages: * printDebug: prints messages only when debugging is turned on * debug_on: turns debugging on * debug_off: turns debugging off * debug_restore: restores the previous debugging state...
C
#include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <search.h> typedef struct { int count; char* key; } Entry; typedef struct { intptr_t sz; intptr_t cap; Entry* entries; } VecEntry; int cmp_by_freq(const void* p, const void* q) { const Entry* x = p; ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "ringbuffer.h" /*initializes the buffer, placing pointers to beginning of buffer*/ void init_buffer(struct buffer_type *b, unsigned char *buffer, int buffer_size){ b->head = buffer; b->tail = buffer; b->beginning = buffer; b->end = buffer + BUFFER...
C
// UCLA CS 111 Lab 1 command interface #include <stdbool.h> //#include "command-internals.h" typedef struct command *command_t; typedef struct command_stream *command_stream_t; /* Create a command stream from GETBYTE and ARG. A reader of the command stream will invoke GETBYTE (ARG) to get the next byte. GETBY...
C
/// Mostre na tela somente /// saida o valor resulta [0][0] = 21 #include <stdio.h> #include <stdlib.h> int main(void){ // executa e mostra na tela ///int i, j, tamanho, valorResultado[4][1]; int i,j, tamX, tamY, valorResultado[4][2]; tamX = sizeof(valorResultado[4][2]...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> int main (void) { char origen[45] = ".:hola:hello:xd"; char *dest = malloc(sizeof(char *)); char *ja = NULL; dest = strtok(origen, ":"); while (dest) { printf("%s\n", ""); printf("%p\n", dest); dest = strtok(NULL, ":"); } return 0; }
C
/* ======================================== * * Copyright YOUR COMPANY, THE YEAR * All Rights Reserved * UNPUBLISHED, LICENSED SOFTWARE. * * CONFIDENTIAL AND PROPRIETARY INFORMATION * WHICH IS THE PROPERTY OF your company. * * ======================================== */ #include "usbserialprotocol.h" #define...
C
#include "libmx.h" int mx_get_substr_index(const char *str, const char *sub) { char *res; int i; int j; if (!str || !sub) { return -2; } i = mx_strlen(str); res = mx_strstr(str, sub); if (res == NULL) return -1; j = i - mx_strlen(res); return j; }
C
#include<stdio.h> struct shape { double length; double width; }; int findPerimeter(struct shape R); int findArea(struct shape R); main() { struct shape z; printf("Enter length of rectangle: "); scanf("%lf",&z.length); printf("Enter area of rectangle: "); scanf("%lf",&z.width...
C
/* ** EPITECH PROJECT, 2018 ** my_showstr.c ** File description: ** simon-perraud */ #include "../../include/my.h" int my_showstr(char const *str, int lenght) { for (int i = 0; i < lenght; i++) { if (str[i] == 0) { write(1, "\\", 1); write(1, "0", 1); } else if (str[i] == 1...
C
#include "appheader.h" int main(int argc, char const *argv[]) { //system("sh readconfig.sh"); FILE * fp=popen("sh readconfig.sh","r"); if(fp==NULL) { perror("popen:"); exit(-1); } char buf[1024]; bzero(buf,sizeof(buf)); fread(buf,sizeof(buf)-1,1,fp); //printf("%s",buf); char *p=buf; int counter=0; while...
C
#include<stdio.h> #include<math.h> #include<string.h> #define size 100012000 char ch[size]; void seive() { int i,j,m,n,root; root=sqrt(size); memset(ch,'1',sizeof(ch)); ch[0]='0'; ch[1]='0'; for(i=2;i<=root;i++) { if(ch[i]=='1') {for(j=2;i*j<=size;j++) ch[i*j]='0'; ...
C
/* SPDX-License-Identifier: 0BSD */ #ifndef MINIFLAC_PADDING_H #define MINIFLAC_PADDING_H #include <stdint.h> #include "common.h" #include "bitreader.h" /* a padding block is supposed to be all zero bytes so * there's not a point in reading but - but who knows, * maybe somebody decides to do something weird with ...
C
/* * Revision Control Information * * $Source: /users/pchong/CVS/sis/stamina/mimi/read_fsm.c,v $ * $Author: pchong $ * $Revision: 1.2 $ * $Date: 2005/03/08 01:07:23 $ * */ #include <stdio.h> #include "user.h" #include "util.h" #include "struct.h" #include "global.h" char *item[5]; void line_parser(); NLIST **h...
C
#include<stdio.h> #define TAM 10 void alimenta_matriz(int vet[TAM]){ for(int i=0;i<TAM; i++){ printf("Posicao %d: ", i+1); scanf("%d", &vet[i]); } } void main(){ int vet1[TAM], vet2[TAM], vet3[TAM]; printf("--Vetor 01--\n"); alimenta_matriz(vet1); printf("--Vetor 02--\n"); alimenta_matriz(vet2); print...
C
/* Name: Nabeeh Kandalaft Course: EGR 226 Date: September-15-2018 Project: LCD Header File File: LCD.h Description: This is a header file for the 4x16 LCD that contains C function declarations, macro definitions, and global variables ...
C
// // CharType.h // wordseg // // Created by Windoze on 12-2-9. // Copyright (c) 2012 0d0a.com. All rights reserved. // #ifndef wordseg_CharType_h #define wordseg_CharType_h #include <unicode/uchar.h> typedef enum _CharType { CT_SEPERATOR, // Seperators, whitespaces, punctuations, anything consider as a wo...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> /* Please read readme.txt for deeper understanding of how code works. *No dependencies Compiled using GNU GCC Compiler This is a Complete C program which has individual functions defined for all operations This is equivalent to a MIPS compiler which has bra...
C
#include "criptografia.h" void* multiplicacao(void* parametros) { Parameters_multiplicacao *p = (Parameters_multiplicacao *) parametros; printf("Thread Multiplicacao %d iniciou.\n", p->coluna); for (int i = 0; i < p->num_linhas; i++) for (int j = 0; j < 4; j++) p->matriz_codigo[i][p->co...
C
/* ** EPITECH PROJECT, 2018 ** str ** File description: ** lstr_append */ #include "str.h" /** * Appends the specifed string to this string. * * **Does directly modify the original string.** **/ char *lstr_append(char *this, const char *str) { char *ret; if (this == NULL || str == NULL) return (N...
C
/* ** EPITECH PROJECT, 2021 ** MyRPG ** File description: ** Draws the rest of the inventory */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include "Rpg/rpg.h" static inline bool is(sfSprite *s, rpg_t *game) { if (sprite_is_hover(s, get_mouse_pos_vec2f(game->wind)) && game->inventory.mouse...
C
#include <stdio.h> int main(void) { int digit, in, power, temp; int repeat, ri; scanf("%d", &repeat); for(ri = 1; ri <= repeat; ri++){ scanf("%d", &in); /*---------*/ printf("\n"); } }
C
#include <stdio.h> int main() { int nr1, nr2; int *ptr; nr1 = 1; nr2 = 2; ptr = &nr1; printf("\n"); printf("nr1 has the value %d and is stored at %p\n", nr1, &nr1); printf("nr2 has the value %d and is stored at %p\n", nr2, &nr2); printf("ptr has the value %d and is stored at %p\n", ptr, &ptr); printf("The va...
C
#include <stdio.h> #include <string.h> int main(void) { int n; int i; int ch; char name[1000]; while((ch = getchar()) != EOF) { name[i] = ch; i++; } n = strlen(name); for(i = 0; i < n; i++) putchar(name[i]); return 0; }
C
#define MAXSIZE 20 typedef int ElemType; typedef struct { ElemType data[MAXSIZE]; int length; }sqlist; Status ListInsert(sqlist *L,int i,ElemType e){ int n; if (i >= L->length || length == MAXSIZE) return ERROR; if (i<1) return ERROR; for (n = L->length;n>=i;n--){ L->data[n]...
C
#include <stdlib.h> #include <stdio.h> static int ft_check_symbol_nb(char *line) { int i; int p; int d; i = 0; p = 0; d = 0; while (line[i]) { if (line[i] == '.') p++; if (line[i] == '#') d++; i++; } if (p == 12 && d == 4) return (0); return (-1); } static int ft_check_shape(char **tab...
C
/* # probe.c: Code for probing protocols # # Copyright (C) 2007-2012 Yves Rutschle # # 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, or (at your option) any ...
C
/* hw3-main.c (v1.1) */ #include <stdio.h> #include <stdlib.h> #include <unistd.h> int next_thread_id; /* initialize to 1 */ int max_squares; /* initialize to 0 */ char *** dead_end_boards; /* initialize as array of NULL pointers of size 4 */ /* write the simulate() function and place all of your...
C
/* E3.c */ #include <stdio.h> #include <math.h> #include <stdlib.h> #include "E3_func.h" #define PI 3.141592653589 /* Main program */ int main() { // Task 1: calculate the integral for different N integral_uniform(); // Task 2: calculate the integral for different N using importance sampling integral_sine(); ...