language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strchr.c :+: :+: :+: ...
C
/* Author: Nathan Smith, CST235 * Date: , '17 */ #include <stdio.h> #include <stdlib.h> #include "funcs.h" void iterateNumbers (int iArray[], int iSize, FNPTR_TYPE fn) { for (int i = 0; i < iSize; ++i) { printf("The value after the function pointer is applied is: %d\n", fn(iArray[i])); } }
C
#include"List.h" void ListInit(pList lt) { assert(lt); lt->head = (pListNode)malloc(sizeof(ListNode)); lt->head->prev = lt->head; lt->head->next = lt->head; } void ListDestory(pList lt) { pListNode cur, del; assert(lt); cur = lt->head->next; while (cur->next!= lt->head) { del = cur; cur = cur->next; fre...
C
#include<stdio.h> #include<stdlib.h> void set_base_down(unsigned long long base[], unsigned long long down[], unsigned long long pre_sum[], unsigned long long n) { for (int i = 0; i < (n+1)/2 + 1; i++) { base[i] = (n-i)*4*i+1; } for (int i = 0; i < (n+1)/2; i++) { down[i] = base[i+1]+base[...
C
#include <stdio.h> #define MAX 10 int queue[MAX]; int front = -1, rear = -1; void insert(void); int delete(void); int peek(void); void display(void); int main() { int option, num; do { printf("\n ***** MAIN MENU *****"); printf("\n 1. Insert an element: "); printf("\n 2. Delete a...
C
#include <stdio.h> #include "arq.h" FILE *open_arq(char *n){ FILE *novo = fopen(n, "r"); return novo; } void pega_linha(FILE *n, int *l, int *co, float *v){ float val; int cont = 0, pos = 0, flag = 0, lin, col; char temp[10], c; do{ c = fgetc(n); if(feof(n) && flag == 0){ *l = -1; *co = -1; ...
C
#include <stdio.h> #include <stdlib.h> void ary_copy(int a[], const int b[], int n) { int i; for (i = 0; i < n; i++) { a[i] = b[i]; } for ( i = 0; i < n; i++) { printf("%d", a[i]); } } int main(void) { int number; int *a; int *b; int i; printf("迭 Էϼ"); scanf_s("%d", &number); a = calloc(number, siz...
C
// register address #define PERI_BASE 0x20000000 #define GPIO_BASE (PERI_BASE + 0x200000) #define BLOCK_SIZE 4096 // gpio pinmode #define INPUT 0x0 #define OUTPUT 0x1 #define ALT0 0x4 #define ALT1 0x5 #define ALT2 0x6 #define ALT3 0x7 #define ALT4 0x3 #define ALT5 0x2 static vo...
C
/* ** toolbox.c for navy in /home/boissi_p/rendu/PSU_2016_navy/src ** ** Made by Pierre-Malick Boissiere ** Login <boissi_p@epitech.net> ** ** Started on Mon Jan 30 15:06:31 2017 Pierre-Malick Boissiere ** Last update Sun Feb 19 16:28:54 2017 Pierre-Malick Boissiere */ #include "my.h" int my_strlen(char *str) { ...
C
#include "uart.h" #include "string.h" #include "bootloader.h" #define INPUT_BUFFER_SIZE 64 void system_start() { uart_puts("---------------------------\n"); uart_puts("Raspberry Pi 3B+ Bootloader\n"); uart_puts("---------------------------\n"); } int main() { // set uart uart_init(); system_s...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* get_piece.c :+: :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> typedef struct{ int key; } element; void buildFlag(void); void mergeSort(element initList[], int n); void mergePass(element initList[], element mergedList[], int n, int s); void merge(element initList[], element mergeList[], int i, int m, int n); void pr...
C
#include "libft.h" char *ft_strrev(char *str) { char swap; int j; int c; j = 0; c = 0; while (str[c] != '\0') { c++; } c--; while (c > j) { swap = str[c]; str[c] = str[j]; str[j] = swap; c--; j++; } return (str); }
C
#include<stdio.h> char c[1000]; int main () { int i; char s[100]; gets(s); for(i=0;i<strlen(s);i++){ s[i]=s[i]; } if(strcmp(s,strrev(s))){ printf("Not Palindrome\n"); } else{ printf("Palindrome\n"); } return 0; }
C
// // test3.c // // // Created by Michael Geiger on 4/13/17. // Simple program to be run in OS Project 1 // #include <stdio.h> #include <unistd.h> int main() { pid_t pid = getpid(); printf("Running program test3 in process %d\n", (int)pid); if ((int)pid % 2) printf("T3: PID %d is odd\n", (int)pid); els...
C
/***************************************************************************** * Copyright Statement: * -------------------- * MobileTech(Shanghai) Co., Ltd. * *****************************************************************************/ /****************************************************************************...
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: ConvierteAMayusculas.c * Author: virgiliopadronbatun * * Created on 24 de julio de 2018, 17:43 */ #include <stdio....
C
// // Created by Yassin Alsahlani on 9/6/18. // #include <stdio.h> #include <stdlib.h> /* Baseline ECE 2035 Homework 1-2 This is the only file that should be modified for the C implementation of Homework 1. This program computes the index (ClassID) at which the maximum value occurs in a set of 10 confidence values...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> int main(int argc, char const *argv[]) { int x1,y1,x2,y2; printf("Entre com o primeiro ponto\n" ); scanf("%d %d",&x1,&y1 ); printf("Entre com o segundo ponto\n" ); scanf("%d %d",&x2,&y2 ); printf("%0.2f\n",sqrt(pow(x2-x1,2)+pow(y2-y1,2))); return 0...
C
#include<stdio.h> main(){ int i,j,array [3] [2]; for (i=0; i<3; i++){ for (j=0; j<2;j++) scanf ("%d",&array [i] [j]); } for (i=0; i<3; i++){ for ( j=0; j<2; j++){ printf("\t%d\t", array [i] [j]); } printf("\n"); } for ( j=0; j<3; j++) { array[j][1]=array[j][0]+array[j][1]; printf("%...
C
/** * @file journal.c * * Function implementations for journaling. */ #include "journal.h" #include "server-part1.h" int callocs = 0; int frees = 0; int log_transaction(transaction *tx) { pthread_mutex_lock(&journal_mutex); FILE *file = fopen("tx_log", "a"); struct stat st; size_t data_len = 0; long by...
C
/********************************************************************************* Copyright 2006-2009 MakingThings 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/lic...
C
/* Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements. */ /* For example, given nums = [0, 1, 0, 3, 12], after calling your function, nums should be [1, 3, 12, 0, 0]. */ /* Note: */ /* You must do this in-place without making a copy of ...
C
/* ** EPITECH PROJECT, 2018 ** libmy-tek2 ** File description: ** dsa / circular_buffer / circular_buffer.c */ #include "my/dsa/circular_buffer.h" circular_buffer_t *cb_create(size_t size) { circular_buffer_t *this = calloc(1, sizeof(circular_buffer_t)); if (!this) return (NULL); this->size = (size == 0) ? CBUF...
C
//exit restricted #include<stdlib.h> struct emp { int id,sal; struct emp *ptr; }; struct emp* start, *front, *rear; void insert_at_end() { //problem struct emp *k; k=(struct emp *)malloc(sizeof(struct emp)); printf("Enter id and sal \n"); scanf("%d %d",&k->id,&k->sal); k->ptr=NULL...
C
//买鸡问题:公鸡每只5元,母鸡每只3元,小鸡每元3只,现用100元买100只鸡,问各买多少只鸡 #include <stdio.h> int main() { int i,j,k; for(i=0;i*5<=100;i++) { for(j=0;j*3<=100;j++) { for(k=0;k/3<=100;k+=3) if(i+j+k==100&&i*5+j*3+k/3==100) printf("Cock--%d\tHen--%d\tChicken--%d\n",i,j,k); } } return 0; }
C
/* * LineCounting.c * * Created on: 20 Jan 2021 * Author: Al */ #include <stdio.h> /* count lines in input */ int main() { int c; int nl; nl = 0; for ( c = getchar(); c != EOF; c = getchar() ) { if (c == '\n') { ++nl; } } (void)printf("%d\n", nl); return 0; }
C
//在一个字符串(1<=字符串长度<=10000,全部由字母组成)中找到第一个只出现一次的字符,并返回它的位置 class Solution { public: int FirstNotRepeatingChar(string str) { int i; set<char> s; if(str.empty())return -1; for(i=0;i<str.size()-1;++i) { if(str.find(str[i],i+1)==string::npos&&s.find(str[i])==s....
C
#pragma once enum CardinalPointFlags { EAST = 1 << 0, NORTH = 1 << 1, SOUTH = 1 << 2, WEST = 1 << 3 }; // Allows for a CardinalPointFlag to hold multiple flags of the same type // Example: // CardinalPointFlag northEast = CardinalPointFlag.NORTH | CardinalPointFlag.EAST; inline CardinalPointFlags operator|(Ca...
C
#include <stdio.h> #include <stdlib.h> int stat[21][21] = {0, }; int flag[21] = {0, }; int team = 0; int min = 10000; void startlink(int n, int index, int combi) { int start = 0; int link = 0; if (team == index / 2) { for (int i = 1; i <= index; i++) { for (int j = 1; j <= index; j++) { if (flag[i]...
C
#include <stdio.h> /* 0 1 2 3 4 5 6 7 8 9 a s d d d f g h d \0 i j d */ int main(void) { char str[20] = {0}; char ch = 0; int i, j; printf("ַҪɾַ"); scanf("%s %c", str, &ch); printf("ǰ"); puts(str); for(i = 0; str[i]!='\0'; i++) { if(str[i] == ch) { for(j = ...
C
#include<stdio.h> #include<math.h> int main() { int t,n,k,i,a[1003],count=0,min,j,num; scanf("%d",&t); while(t--) { scanf("%d%d",&n,&k); for(i=0;i<n;i++) { scanf("%d",&a[i]); } min=2000000000; if(n==2) { printf("%d 1\n",abs(a[0]+a[1]-k)); } else { for(i=0;i<n-1;i++) ...
C
//template for testing code //download with: wget troll.cs.ua.edu/ACP-C/tester.c #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> int main() { int steps; double miles; printf("Input the number of steps you have taken today: "); scanf("%d", &steps); miles = (double) s...
C
#include <stdio.h> #include <stdlib.h> int buscaBin(int*, int, int, int); int main() { int N, M; scanf("%d", &N); int *v1 = (int*)malloc(sizeof(int*) * N); for (int i = 0; i < N; i++) { scanf("%d", &v1[i]); } scanf("%d", &M); int *v2 = (int*)malloc(sizeof(int*) * M); for...
C
#include<stdio.h> void main() { int a,b,c,ans; scanf("%d%d%d",&a,&b,&c); ans=a*b%c; printf("%d",ans); }
C
/* * metering.c * * Created on: 20.04.2011 * Author: G�nter Hildebrandt */ #include "metering.h" #include <avr/io.h> #include <util/delay.h> #include "sys/clock.h" #include "contiki.h" #include "dev/leds.h" #include <avr/eeprom.h> #include "eeprom_variables.h" #include "dev/leds.h" #include "relay.h" /** \...
C
/************************************************************************* > File Name : processMemory.c > Author : lirongwei > Mail : a2413044193@gmail.com > Created Time : 2020/07/08 09:47:54 ************************************************************************/ #include<stdio.h> /** *...
C
#include<stdio.h> int main() { void swap(int *, int *); int i, j, a[10]; printf("Please enter 10 numbers:\n"); for(i=0; i<10; i++) scanf("%d", &a[i]); printf("The original order is:\n"); for(i=0; i<10; i++) printf("%d\t", a[i]); printf("\n"); for(i=0; i<+(9-1)/2; i++) swap((a+i), (a+9-i)); printf("The...
C
/* 2015-06-16 bluepp May the force be with me! Note: This is an extension of House Robber. After robbing those houses on that street, the thief has found himself a new place for his thievery so that he will not get too much attention. This time, all houses at this place are arranged in a circle. That means...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* other.c :+: :+: :+: ...
C
/* * op.c * Copyright (C) 2013 National University of Singapore * * 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 3 of the License, or * (at your option) any later version...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* header.c :+: :+: :+: ...
C
/* ------------------------------------------------ * Vorspann * ------------------------------------------------ */ // CPP-Definition für Maximale Anzahl der Eingabeversuche #define MAXVERSUCH 3 // Header-Dateien der C-Standardbibliothek einlesen #include <stdio.h> // enthält Deklarationen für ...
C
#include<stdio.h> main() { int i,j,n[100]; printf("Enter 5 nos\n"); for(i=0;i<5;i++) { scanf("%d",&n[i]); /*if(n[i]==5) {*/ break; /*} */ } for(j=i+1;j<5;j++) { n[j]=0; } printf("The nos are\n"); for(i=0;i<5;i++) { printf("%d\n",n[i]); } }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* philo.h :+: :+: :+: ...
C
#include<stdio.h> #include<stdlib.h> #include<sys/types.h> #include<sys/socket.h> #include<netinet/in.h> #include<string.h> #include<unistd.h> void error(const char* msg) { perror(msg); exit(1); } int main() { int c_sock; //call socket() function with necessary parameters for UDP c_sock = socket(AF_INET, SOCK...
C
#include "heap.h" #include <stdio.h> int main() { struct Heap h; struct Heap * p = &h; int v[] = {7, 16, 49, 82, 5, 31, 6, 2, 44}; int i; heap_init(p); for( i = 0; i < sizeof(v) / sizeof(v[0]); i++ ) { heap_push(p, v[i]); } while( h.size ) { int value; if( heap_pop(p, &value) ) { printf("[%2d]...
C
#include <stdio.h> #include <stdlib.h> #include "matrix.h" #include <math.h> int** matrixInit(int rows, int cols, int value){ //creating the array int** myMatrix = (int**)malloc(rows * sizeof(int*)); for (int i = 0; i < rows; i++){ myMatrix[i] = (int*)malloc(cols * sizeof(int*)); for (int...
C
#include <stdio.h> #include <unistd.h> #include <sys/types.h> #include <sys/ipc.h> #include <sys/shm.h> #include <sys/wait.h> #include <sys/sem.h> #include <semaphore.h> #include <sys/errno.h> #include <string.h> #include <limits.h> #include <stdlib.h> #include <signal.h> #include <sys/stat.h> #include <sys/resource.h>...
C
/*Basic program to print address of a variable*/ /*C in Depth P9.1 example*/ #include<stdio.h> int main() { int age = 30; float salary = 1500.50; printf("Address of age = %p\n", &age); printf("Address of salary = %p\n", &salary); return 0; }
C
#include <inttypes.h> #include <avr/io.h> #include <avr/pgmspace.h> #include "avrlaunch/avrlaunch.h" #include "avrlaunch/log.h" #include "avrlaunch/shell.h" #include "avrlaunch/pgmspace/pgm_strings.h" #include "avrlaunch/hal/atmega328p/hal_adc.h" #define NO_DUMMY -1 static int8_t dummy_channel = NO_DUMMY; static v...
C
#include <tcpip/h/network.h> /*------------------------------------------------------------------------ * tfinsert - add a new TCP segment fragment to a TCB sequence queue * * 将数据插入到ptcb->tcb_rsegq中去 *------------------------------------------------------------------------ */ int tfinsert(struct tcb *p...
C
#include <stdio.h> #include <stdlib.h> #include <pthread.h> typedef struct queue { int capacity; int size; int front; int rear; pthread_t *elements; } queue; queue *create_queue(int maxElements) { queue *q = (queue *)malloc(sizeof(queue)); q -> elements = (int *)malloc(sizeof(pthread_t) * ...
C
/* * Project1.c * * Created: 1/18/2019 7:50:43 PM * Author : Kian Farsany */ #include <avr/io.h> #include "avr.c" void wait_half() { volatile int i,n = 17000; for (i = 0; i < n; ++i) { //blah } } int main(void) { DDRB = 1; while (1) { if (GET_BIT(PINB, 1) == 0) { PORTB = 1; //wait_half...
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 "sort.h" /** *bubble_sort - Sorts an array of integers in ascending order. *@array: Array of integers. *@size: Size of the array. *Return: Nothing. */ void bubble_sort(int *array, size_t size) { size_t a, b; if (size < 2) return; for (a = 0; a < size - 1; a++) for (b = 0; b < size - 1; b++) if ...
C
//first device #include <fcntl.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include <sys/ioctl.h> #include <unistd.h> #include <pthread.h> #include <time.h> #include "gpio_ioctl.h" #include <stdint.h> #include <poll.h> #define SIZE_OF_BUF 5 /*Ring buffer size*/ #define ...
C
//------------------------------------------ // D.c // //------------------------------------------ #include <stdio.h> #include <stdlib.h> // Macro for Debugging #define DEBUG #define TMP int main (void){ int N; int i,j; int t[110],v[110]; /*tの値とvの値を格納*/ double gragh[500]; int sumt; double tmp; printf("...
C
#include "holberton.h" /** * get_bit - that returns the value of a bit at a given index. * @n: number * @index: index * Return: the converted number */ int get_bit(unsigned long int n, unsigned int index) { if (index < 64) { n >>= index; return (n & 1); } return (-1); }
C
/* * f_ops.h * * Created on: 2017年5月22日 * Author: YJ-User17 */ #ifndef __F_OPS_H__ #define __F_OPS_H__ /* ips */ #include "fs.h" /* fs write */ static int fs_write(struct file * filp,const char * buffer , unsigned int buflen) { /* judge */ if( filp != 0 && filp->f_inode->ops.write != 0 ) { return fi...
C
#define MaxVertexNum 100 typedef int Vertex; typedef int WeightType; typedef char DataType; typedef struct ENode* PtrToENode; struct ENode { Vertex V1,V2; WeightType Weight; }; typedef PtrToENode Edge; typedef struct AdjVNode* PtrToAdjVNode; struct AdjVNode { Vertex AdjV; WeightType Weight; PtrTo...
C
/*该头文件主要定义了文件系统的数据结构,全局变量定义*/ #include"block.h" #ifndef FILESYSTEM_H_INCLUDED #define FILESYSTEM_H_INCLUDED //定义当前环境 1为开发环境 0为生产环境 #define ENV 0 struct fatitem { //存放文件下一个磁盘的指针 int item; //磁盘块是否空闲的标志位 0为空闲 char em_disk; }; struct openFile { //当前打开的文件表 struct openFileItem { //文件名 char name[9]; //起始盘块号 ...
C
#include <time.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <dirent.h> #include <unistd.h> #include <sys/stat.h> #include <sys/types.h> void find(char *fn,char *dir); int main(int argc, char *argv[]) { char *fn = NULL; char *dir = NULL; int c; opterr = 0; while ((c = get...
C
#include "strutil.h" #include <stdio.h> #include <stdbool.h> #include <stdlib.h> #include <string.h> char *substr(const char *str, size_t n) { if (n > strlen(str)) { char *cadena = malloc(sizeof(char) * (strlen(str) + 1)); if (!cadena) return NULL; strcpy(cadena, str); return cadena; } c...
C
#include <stdio.h> #include <conio.h> main() { void wczytywanie(int [],int ); void drukowanie(int [],int ); int a[10],b[10],k,m,n; do { printf("\n Podaj ilosc elementow ciagu a:\n m = "); k=scanf("%d",&m); fflush(stdin); } ...
C
/* Que 10 : Write a C program to count number of digits in a number. owner:Aditya Wagh Batch:PPA9 */ //Solution #include<stdio.h> void main() { int n; int count=0; //initialization printf("enter the number : \n"); scanf("%d",&n); while(n!=0) { n=n/10; count+=1; } //end of while...
C
#include <stdlib.h> #include <stdio.h> #include "xmalloc.h" #include "linkedlist.h" conscell *ll_push(conscell *list, void *data) { conscell *new = xmalloc(sizeof *new); new->data = data; new->next = list; return new; } conscell *ll_pop(conscell *list) { if(list == NULL) return NULL; conscell *p = list->next; ...
C
#include "DataStruct.h" #include "AVL_Tree.h" //int main(int argc, const char * argv[]) { //// BinTree t1,t2,t3,t4,t5; //// t1=(BinTree)malloc(sizeof(BinTree)); //// t2=(BinTree)malloc(sizeof(BinTree)); //// t3=(BinTree)malloc(sizeof(BinTree)); //// t4=(BinTree)malloc(sizeof(BinTree)); //// t5=(BinTr...
C
#include "solver.h" #include "mouse.h" // This function redirects function calls from mouse.c to the desired maze solving algorithm Action solver(Mouse *mouse) { // This can be changed to call other maze solving algorithms return leftWallFollower(mouse); } // Simple algorithm; mouse goes straight ...
C
// A C program to implement flood fill algorithm #include<stdio.h> // Dimentions of paint screen #define M 8 #define N 8 // A recursive function to replace previous color 'prevC' at '(x, y)' // and all surrounding pixels of (x, y) with new color 'newC' and void floodFillUtil(int screen[][N], int x, int y, int p...
C
#include "holberton.h" /** * get_bit - This function returns the value of a bit at * a given index * @n: The bit passed to the function * @index: The index to find * Return: The value of a bit at that given index */ int get_bit(unsigned long int n, unsigned int index) { /* shift to the index */ unsigned int v...
C
// // algorithm_ practice.h // Algorithm-C // // Created by 掌上汇通Mac on 2018/10/24. // Copyright © 2018 掌上汇通Mac. All rights reserved. // #ifndef algorithm__practice_h #define algorithm__practice_h #include <stdio.h> #endif /* algorithm__practice_h */ /*题目:一个整数,它加上100后是一个完全平方数,再加上168又是一个完全平方数,请问该数是多少?*/ void squa...
C
#include<stdio.h> #include<stdlib.h> struct node { int data; struct node *next; }; void addqatend(struct node **f , struct node **r, int num ) { struct node *temp; temp = (struct node *)malloc(sizeof(struct node)); temp->data = num; if(*f == NULL ) { temp->next = NULL; *f = *r = temp; } else { (*r...
C
/** */ #include <stdio.h> #include <string.h> #include <openssl/rsa.h> #include <openssl/sha.h> #include <openssl/objects.h> #include <openssl/pem.h> #include <openssl/err.h> // 3072, 7680, 15360 #define PRIVATE_KEY_FILE "RSAPriKey_3072.pem" #define PUBLIC_KEY_FILE "RSAPubKey_3072.pub" typedef unsigned char byte...
C
#include<stdio.h> int main(){ float varA, varB, varC, result, PI; int opcao; PI = 3.1415; printf("--------------------------\n"); printf("Bem vindo a calculadora:\n"); printf("--------------------------\n"); printf("Escolha uma opção:\n"); printf("1) para volume da caixa:\n"); ...
C
/* * Simple debugging memory allocator. * * Each memory block is laid out as follows: * * +--------+-----------------+------+------------------+-------------------+ * | header | redzone | data | unused remainder | redzone | * +--------+-----------------+------+------------------+--------...
C
/* * See what happens whan mapping a non-truncated file and what happens * when doing private mapping on a file. * * 2011, Razvan Deaconescu, razvan.deaconescu@cs.pub.ro */ #include <stdio.h> #include <string.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> #include <sys/types.h> #include <sys/mman....
C
#include "VMsimulator.h" /* * Justin Barish * Jack Kraszewski * * We pledge our honor that we have abided by the Stevens Honor System */ struct node{ frame p; struct node* next; struct node* prev; }; typedef struct node* Node; Node head = NULL; Node tail = NULL; /* * [tail] ...
C
#include <stdio.h> int main() { freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); int a, b; scanf("%d%d", &a, &b); int c = a; a = b; b = c; printf("%d %d", a, b); return 0; }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* format.c :+: :+: :+: ...
C
#include <stdio.h> int main() { printf("The character\n \0 is used to terminate a string."); char my_string[10]; // indicates that there is only only 9 spaces for characters because the last char has to be a null terminator '\0' char word[] = {'H', 'e','l','l','o','!'}; char word_2[] = {"hello"}; ...
C
/*-------------------------------------------------------------------------------- * Libraries *--------------------------------------------------------------------------------*/ #include "Task.h" #include "Timer.h" /* software components includes */ #include "Sensor.h" #include "Ligh...
C
/*file ptask.c details This module contains the functions to create and manage the tasks author Davide Rasla todo */ #include "main.h" //---------------------------------------- // PTASK LIBRARY //---------------------------------------- /* This function creates a periodic task setting the...
C
#include <math.h> #include <stdio.h> #include <stdlib.h> /* * 9. Palindrome Number * Determine whether an integer is a palindrome. * Do this without extra space. * * Runtime: 48ms */ int palindrome(int num) { if(num < 0) { return 0; } if(num < 10) { return 1; } int n = log10(num); int l = n + 1; int ...
C
#include "holberton.h" /** *_strcat - concatenates two strings *@src: source *@dest: destination *Return: return a pointeur to tthe resulting string */ char *_strcat(char *dest, char *src) { int char_end_src;/*array nuber with value '\0' in src*/ int i; /*loocking for '\0' in dst*/ { for (i = 0 ; dest[i] != '...
C
/*12279 - Emoogle Balance*/ #include <stdio.h> int main(){ int casos, cont=1, i; while(scanf("%d", &casos) != EOF){ if( casos==0){ break; } int num; int tot=0; for(i=0; i<casos; i++){ scanf("%d", &num); if(num==0){ tot--; } else{ tot++; } } printf(...
C
#include<stdio.h> #include<math.h> int main(){ double n,m; printf("Enter a number : \n"); scanf("%lf",&n); m=log10(n); printf("Number of digits = %lf",m+1); return 0; }
C
#include<stdio.h> #include<stdlib.h> #include<math.h> #define N 101 int ord (const void * a, const void * b) { return ( *(float*)b - *(float*)a ); } float l1(float wcl[], float cap_veicolo, float ncl){ float tot_pesi=0., l1; for(int i=0; i<ncl; i++){ tot_pesi+=wcl[i]; } l1 = tot_pesi/cap_veicolo; ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_utils.c :+: :+: :+: ...
C
#include<stdio.h> int main() { int a,kvadrat,kub; printf("\n Vasheto chislo e:"); scanf("%d",&a); kvadrat=a*a; printf("\n%d",kvadrat); kub=kvadrat*a; printf("\n%d",kub); }
C
/* * @Description: - * @Version: - * @Author: Fox_benjiaming * @Date: 2020-10-21 01:06:55 * @LastEditors: Fox_benjiaming * @LastEditTime: 2020-10-22 01:25:00 */ #include <string.h> #include <stdio.h> #include <stdbool.h> #include <fcntl.h> #include <pthread.h> #include <sys/time.h> #include <stdlib.h> #include <...
C
#ifndef UTILS_H_ #define UTILS_H_ #include "common/lamp_config.h" static Notification* SelectNotification(lamp_config_t* config, jenkins_status_t status) { Notification* n = NULL; for (int i = 0; i < JENKINS_STATUS_NR_ITEMS; i++){ if (config->notification_list[i].jenkins_status == status) { ...
C
#ifndef _LINKED_LIST_SET_ #define _LINKED_LIST_SET_ #include "LinkedList.h" typedef struct LinkedListSet LinkedListSet; struct LinkedListSet { LinkedList *ll; }; LinkedListSet* create_linked_list_set() { LinkedListSet *lls = NULL; lls = (LinkedListSet*)malloc(sizeof(LinkedListSet)); lls->ll = create_linked_list();...
C
/**********************SY-1ʵ鿪************************ * ƽ̨SY-1+STC89C52 * ƣSY-1 ʵλʾ05 * ˾˼ԴӿƼ޹˾ * д˼Դ * ڣ2012-12-25 * QQ : 936559219 * :11.0592MHZ ******************************************************************/ #include <reg51.h> sbit dula=P2^6; //ѡźŵ sbit wela=P2^7; //λѡźŵ unsigned char code wei[]={0xf...
C
#include <stdio.h> int main(){ int quantidade_minima, quantidade_maxima; float estoque_medio; printf ("Informe a quantidade minima: "); scanf("%d", &quantidade_minima); printf("Informe a quantidade maxima: "); scanf("%d", &quantidade_maxima); estoque_medio = (quantidade_minima + quan...
C
#include <stdio.h> #include <stdlib.h> #include "binaria.h" int bin_vazia(no_bin *arvore) { return arvore == NULL; } no_bin *bin_buscar(no_bin *arvore, int valor) { if (!bin_vazia(arvore)) { if (valor == arvore->info) return arvore; else if (valor < arvore->info) return...
C
#include <stdio.h> #include <stdlib.h> typedef struct Node { int data; struct Node *next; } node; typedef node *nodePtr; int size (), empty (),exist ( int, int *), pop ( int *), stackLen = 0; void printStack (), push ( nodePtr); nodePtr head = NULL, tail = NULL; int main(){ setvbuf( stdout, NULL, _IONBF, ...
C
#pragma warning( disable : 4996) #include<stdio.h> #include<stdlib.h> #include"Database.h" #define SHOW_HOTEL_STATUS 1 #define ADD_CUSTOMER 2 #define CHECKIN 3 #define CHECKOUT 4 #define SHOW_ROOM_DETAILS 5 #define UPPER_FIRST_LETTERS 6 #define SUB_STRING_NAME 7 #define EXIT -1 void main() { int choi...
C
/* Here will go the prototype functions for the HashTable ADT */ #include "ListBook.h" #include <stdio.h> /*Declaration of the HashTableHndl empty pointer. Set it to null *when you first use it! */ typedef struct HashTableStruct * HashTableHndl; /* makes the new hash table and puts an array of BookListHndls * of s...
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...