language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #ifndef __PI_BITSUPPORT_H__
#define __PI_BITSUPPORT_H__
// some simple bit manipulation functions: helps make code clearer.
// set x[bit]=0 (leave the rest unaltered) and return the value
static inline
uint32_t bit_clr(uint32_t x, unsigned bit) {
assert(bit<32);
return x & ~(1<<bit);
}
// set x[bit]=1 (leave... |
C | /* ************************************************************************** */
/* LE - / */
/* / */
/* main.c .:: .:/ . .:: ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "libtime.h"
#include "liberrmsg.h"
static char HMSG[]=
{"\
Description: Calculate dt for {D T - F Y}, return value is in seconds.\n\
Usage: %-6s (-Dyyyy/mm/dd | -Jyyyy/ddd)\n\
(-Thh:mm:ss.sss)\n\
(-Fyyyy/mm/dd ... |
C | void triangulo (int n);
int main ()
{
int n;
triangulo (n);
return 0;
}
|
C | #include<stdio.h>
int main()
{
int number1, number2;
int flag; //ƴϢ
char ch;
scanf("%d", &number1);
flag = 1;
while ((ch = getchar()) != '=')
{
scanf("%d", &number2);
switch (ch)
{
case '+': number1 += number2; break;
case '-': number1 -= number2; break;
case '*': number1 *= number2; break;
c... |
C | #include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
// Ķͷ ־ ڿ const ־ϴ. Ϸ ڿ ؼ ϼ.
bool solution(const char* s) {
bool answer = true;
int len = strlen(s);
if (len != 4 && len != 6) return false;
for (int i = 0; i < len; i++) {
if (s[i] >= '0' && s[i] <= '9') {
continue;
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* init_pages.c :+: :+: :+: ... |
C | #include "libft.h"
void ft_vecresize(t_vector *vec)
{
char *tmp;
if (!vec || !(tmp = (char*)malloc(vec->max * 2 + 1)))
return ;
ft_memmove(tmp, vec->arr, vec->len);
*(tmp + vec->len + 1) = 0;
free(vec->arr);
vec->arr = tmp;
vec->max *= 2;
} |
C | #include <stdlib.h>
#include <time.h>
#include <stdio.h>
/* more headers goes there */
/**
*main-use print
*Return: print ten numbers from zero
*/
/* betty style doc for function main goes there */
int main(void)
{
int count;
/* your code goes there */
for (count = 0; count < 10; count++)
{
printf("%d", coun... |
C | #include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>
#include "Constraint.c"
#include <string.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
void writeToFile(char text[]){
FILE *fptr;
fptr = fopen("placer.txt","w");
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <math.h>
/*
The prime factors of 13195 are 5, 7, 13 and 29.
What is the largest prime factor of the number 600851475143 ?
*/
//http://www.puzzles9.com/how-to-find-prime-numbers-how-to-check-if-a-number-is-prime/
int is_prime(long... |
C | #include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "Interface.h"
int main(void)
{
FILE *fp = fopen("out.txt", "w");
struct Interface *pInterfaceA = 0, *pInterfaceB = 0;
struct Interface *pInterfaceA_2 = 0, *pInterfaceB_2 = 0;
printf("This is OO-like C program test\n");
if (!fp)... |
C | #include <stdio.h>
#include<string.h>
int main()
{
int length,i,j;
scanf("%d",&length);
char str[length+1];
scanf("\n%[^\n]s",str);
for(i=0;str[i];i++){
if(str[i]=='a' ||str[i]=='e'||str[i]=='i'||str[i]=='o'||str[i]=='u'){
for(j=i+1;str[j];j++){
str[j-1]=str[j];
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* fork_execve.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include <semaphore.h>
#include <unistd.h>
#include "lift.h"
#include "si_ui.h"
// Unfortunately the rand() function is not thread-safe. However, the
// rand_r() function is thread-safe, but need a pointer to an int to
// store the curren... |
C | #include <iostream>
using namespace std;
int main()
{
char ch;
while(true)
{
cin.get(ch);
if(!cin)
break;
cout << ch;
}
return 0;
}
|
C | /*****************************************************
* *
* spin button *
* *
* GTK+ 3 *
* Versao: 1.0 ... |
C | #include "MDR_HSRPRP_ProxyTable.h"
#include <MDR_Ethernet_FrameDefs.h>
#include "MDR_HSRPRP_Config.h"
typedef union {
uint32_t loMAC32;
uint16_t hiMAC16;
uint16_t busy;
uint32_t timeRX;
} MDR_ProxyItemMAC;
MDR_ProxyItemMAC _TableMAC[HSR_ProxyNodeTableMaxEntries];
bool MDR_ProxyTable_HasMAC(uint8_t *MAC... |
C | #include<stdio.h>
#include<math.h>
#define tol .0001
float g(float x)
{
return 1/(sqrt(1+x));
}
int main()
{
int i=1;
float x,x1,x2;
printf("Enter the value of x1\n");
scanf("%f", &x1);
printf("x1\t\t x2\t\t g1\n");
do{
x2=x1;
x1=g(x1);
i++;
printf("%f\t %... |
C | #ifndef __FT_PRINTF_H
# define __FT_PRINTF_H
# include "libft.h"
# include <stdarg.h>
# include <stdlib.h>
# include <stdbool.h>
# include <limits.h>
# define error -1
# define BUFFER_SIZE 4096
typedef struct s_flags
{
bool flag_plus;
bool flag_less;
bool flag_space;
bool flag_zero;
bool f... |
C | #include<stdio.h>
void main()
{
int i,j,k,n,count = 0;
char ch = 'a';
printf("enter the number of rows to print\n");
scanf("%d",&n);
for(i = 1 ; i <= n ; i++)
{
for(j = 1 ; j <= n-i ; j++)
{
printf(" ");
}
for(k = 1 ; k <= i ; k++)
{
printf("*")... |
C | /* I used this program to brute force the 5/8 voltage divider */
/* needed by the i2c chip as my hand-attempts never worked right */
#include <stdio.h>
#include <math.h>
#define NUMBER 48
double values[NUMBER]={
100.0,110.0,120.0,130.0,150.0,160.0,180.0,
200.0,220.0,240.0,270.0,
300.0,330.0,360.0,390.0,
... |
C | #include "decls.h"
#include <stdbool.h>
#define LEFT_SHIFT 16
/**
* Handler para el timer (IRQ0). Escribe un carácter cada segundo.
*/
static const uint8_t hz_ratio = 18; // Default IRQ0 freq (18.222 Hz).
void timer() {
static char chars[81];
static unsigned ticks;
static int8_t line = 20;
static uint8_t idx... |
C | #include <sys/socket.h> /* socket definitions */
#include <sys/types.h> /* socket types */
#include <arpa/inet.h> /* inet (3) funtions */
#include <netdb.h> //gethostbyname, ecc
#include <stdio.h> //input-output printf
#include <string.h> //operazioni su... |
C | #include <stdio.h>
#include <stdlib.h>
#include "ctype.h"
// for basic socket communication
#include <sys/socket.h>
#include "error.h"
#include "system.h"
#include "network.h"
#include "config.h"
#include "hashtable.h"
#include "network-utils.h"
size_t parse_kv_pairs(const char *in_msg, ssize_t length, size_t starti... |
C | /**
*@brief DHCP server
*@author ayakatakuriko
*@date 2018/12/14
* */
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <inttypes.h>
#include "server.h"
#include "utility.h"
#include "dhcp.h"
/**
* @biref クライアントを双方向リストの最... |
C | #include <stdio.h>
main()
{
float fahr,celsius;
int lower,upper,step;
lower = 0; //温度表的下限
upper = 300; //温度表的上线
step = 20; //步长
printf("Celsius Fahr\n");
celsius = lower;
while(celsius <= upper){
fahr = (9.0 * celsius) / 5.0 + 32.0;
printf("%3.0f\t%6.1f\n",celsius,fahr);
celsius = cel... |
C | #include <stdio.h>
#include <cs50.h>
#include <math.h>
int main(void)
{
//Ask the user for amount of change (only positive)
float change;
do
{
change = get_float("Change owed: ");
}
while (change < 0);
// change dollars for cents
int cents = round(change * 100);
// define th... |
C | #include <stdio.h>
#define N 1000
void swap(int * x, int * y);
int main(){
int i, n, a[N], k;
scanf("%d", &n);
for (i=0;i<n;i++) {
scanf("%d", &a[i]);
}
for (i=0;i<n;i++) {
for (k=0;k<n;k++) {
if (a[i] == a[k] && i!=k) a[i] = -100000000;
}
}... |
C | #include "led.h"
#include "stm32f10x.h"
#include "delay.h"
void LED_Init() {
GPIO_InitTypeDef GPIO_InitStructure;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE); //ʹ PB ˿ʱ
//nled
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_14; // pin10
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; //
GPIO_InitStructure.GPI... |
C | #include<stdio.h>
typedef struct date
{
int year;
int month;
int day;
}DATE;
typedef struct student
{
long studentID;
char studentName[10];
char stdentSex;
DATE birthday;
int score[4];
}STUDENT;
int main()
{
STUDENT stu1 = {100310121, "",'M', {1991,5,19},{72,38,90,82}};
STUDENT stu2;
stu2 ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* for_wchar.c :+: :+: :+: ... |
C | #include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
/*Задание: напишите программу, создающую процесс-зомби. Выведите
на экран его pid и посмотрите в другом окне терминала, как обозначается
данный процесс при вызове команды просмотра состояния процессов (ко-
манда ps)*/
int main()
{
pri... |
C | /*
* Airown - utility functions
*
* Copyright (C) 2010 sh0 <sh0@yutani.ee>
*
* 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 la... |
C | // Implementation of cprintf console output for user environments,
// based on printfmt() and cputs().
//
// cprintf is a debugging facility, not a generic output facility.
// It is very important that it always go to the console, especially when
// debugging file descriptor code!
#include <types.h>
/* #include <spinl... |
C | #include "common.h"
#include <stdarg.h>
FILE *log_fp = NULL;
void init_log(const char *log_file) {
if (log_file == NULL) return;
log_fp = fopen(log_file, "w");
Assert(log_fp, "Can not open '%s'", log_file);
}
char log_bytebuf[80] = {};
char log_asmbuf[80] = {};
static char tempbuf[256] = {};
void strcatf(char... |
C | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#define COMBINE_STRING_LITERAL(x, y) x##y
#define PREPARE_COMBINE_STRING(x, y) COMBINE_STRING_LITERAL(x, y)
#define STRING_IN_QUOTES(a) #a
#define PREPARE_STRING_IN_QUOTES(a) STRING_IN_QUOTES(a)
#define BUFF_SIZE 64
/***************************************************... |
C | //Nome: Rafael Daily Santos Martins
//Matrcula: 11721EEL001
#include <stdio.h>
int a (int m, int n)
{
if(m==0)
return n+1;
else if(m>0 && n==0)
return a(m-1, 1);
else if(m>0 && n>0)
return a(m-1, a(m, n-1));
}
int main ()
{
int m, n;
printf("Digite m: ");
scanf("%d", &m);
printf("\nD... |
C | #include<conio.h>
#include<stdio.h>
void main()
{
clrscr();
as();
getch();
}
int as()
{
int b=2,h=3,area;
area=b*h;
printf("The Area of Parallelogram is :-%d",area);
} |
C | /*
* lab_design.h
*
* Created on: May 28, 2015
* Author: shaunpur
*/
#ifndef LAB_DESIGN_H_
#define LAB_DESIGN_H_
/* includes */
#include <inttypes.h>
#define BLUE_MASK 0x000000FF
#define GREEN_MASK 0x0000FF00
#define RED_MASK 0x00FF0000
// pull out the color component and return as... |
C | #include <stdio.h>
int main()
{
char a[40];
char b[40];
printf("a=");
scanf("%s",a);
printf("b=");
scanf("%s",b);
int i=0;
for(i=0;a[i]!='\0' && b[i]!='\0';i++)
{
if(a[i]!=b[i])
{
break;
}
else
{
continue;
}
}
if(a[i]=='\0' && b[i]=='\0')
{
printf("相等\n");
}
else
{
printf("不相等... |
C | #include<stdio.h>
#include<conio.h>
#include<math.h>
#include<stdlib.h>
struct HeapNode{
int* Array;
int count;
int index;
};
typedef struct HeapNode HNode;
HNode* NewNode(int count){
HNode* newNode=(HNode*)malloc(sizeof(HNode));
newNode->index=0;
newNode->count=count;
newNode->Array=(int*)malloc(sizeof(int)*new... |
C | /*
* Przykadowy program dla kursu "POSIX Threads" z wikibooks.pl
*
* Temat: priorytety wtkw
*
* Autor: Wojciech Mua
* Ostatnia zmiana: 2010-03-xx
*/
#define _XOPEN_SOURCE 500
#include <stdlib.h>
#include <stdio.h>
#include <pthread.h>
#include <sched.h>
#include <errno.h>
#include <unistd.h>
#define test_errno... |
C | #include <stdio.h>
#include <stdlib.h>
#define ARRAY_SIZE 13
int linear_search (int array[], int n, int key)
{
int i;
for (i = 0; i < n; i++) {
if (array[i] == key) {
return i;
}
}
return -1;
}
void print_array(int array[], int n)
{
int i;
for (i = 0; i < n; i++) {
printf("%d ", array[i])... |
C | #include <stdio.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <pthread.h>
char buf1[1024];
char buf2[1024];
int fd;
void *thr_rtn(void *arg)
{
int n;
if ((n = pread(fd, buf1, 1024, 3)) < 0) {
printf("thread 1: pread error: %s\n", strerror(errno));
return (void *)1;
... |
C |
#include "libft.h"
/*This function applies the parameter function f to each character of a string
* also passed in it's parameter at at precisely that character's index string
* position. Each character that is passed into the function f is modified if
* necessary.*/
void ft_striteri(char *s, void (*f)(unsigned... |
C | #include <stdio.h>
int a[1005];
void puzyr(int n) {
int i,j,t;
for (i=1; i<=n-1; i++)
for (j=1; j<=n-i; j++)
if (a[j]<a[j+1]) {
t=a[j];
a[j]=a[j+1];
a[j+1]=t;
}
return;
}
int main() {
int n,k;
int s=0;
scanf("%d",&n);
for (k=1; k<=n; k++)
scanf("%d",&a[k]);
puzyr(n);
for (k=1; k<=n; k+=3)
... |
C | #include<stdio.h>
//#include<conio.h>
int main()
{
float tim;
//clrscr();
printf("Enter the Time taken by the Worker to Complete the Work(In Hrs): ");
scanf("%f", &tim);
if(tim>=2 && tim<3)
printf("You are a Highly Efficient Worker");
else
if(tim>=3 && tim<4)
printf("You must Improve your Speed");
else
if(tim>=4 && t... |
C | /* ###
* IP: GHIDRA
*
* 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
*
* Unless required by applicable law or agreed to in writin... |
C | /*
* Copyright (c) 2015-2019 Intel Corporation.
* All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
*/
#ifndef _SPRINTF_H_
#define _SPRINTF_H_
#include "vmm_base.h"
/* maximum string length */
#define MAX_STR_LEN 0x1000
/* The strnlen_s function computes the length of the string pointed to by str... |
C | //gcc -Wall -march=haswell -std=c11 -O2 -o a.out source_file.c
//clang -std=c11 -mavx avxvec.c -o avxvec
#include <x86intrin.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
void clear_array(float *array, int size)
{
for (int i = 0; i < size; i++)
array[i] = 0;
}
void fill_from_to(float *array,... |
C | #include <stdio.h>
#include <string.h>
#include "file_reader.h"
#include "line_reader.h"
enum file_phase_t {
INPUT_PHASE,
OUTPUT_PHASE,
NODES_PHASE
};
typedef enum file_phase_t File_phase;
Logical_circuit* read_logical_circuit_file(char* filepath) {
FILE *file;
File_phase file_phase = INPUT_PHASE;... |
C | /* ************************************************************************** */
/* */
/* :::::::: */
/* ft_paths_better_eval.c :+: :+: ... |
C | /*
** EPITECH PROJECT, 2017
** switch.c
** File description:
** each carac on a string
*/
#include "../include/included.h"
int get_line(char **map)
{
int x = 0;
while (map[x] != NULL)
x++;
return (x);
}
void my_sw(int **map)
{
for(int y = 0; map[y]; y++)
{
for(int x = 0; map[y][x] != -1; x++)
{
if (... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* push_swap.c :+: :+: :+: ... |
C | /* getLine.c
* Implements the getLine function for CS 3 Lab 2
* Alex Lew
* 11/8/15
*/
#include <stdlib.h>
#include <stdio.h>
#define DEFAULT_ALLOC_SIZE 10
/* Read the next line of the standard input into a newly allocated
* buffer. Returns a pointer to that buffer if successful. If unable
* to allocate memory,... |
C | #include <stdio.h>
#include <stdlib.h>
int main(int ac, char **av)
{
int input;
int startc;
int endc;
int start;
int end;
int current;
scanf("%d%d", &start, &end);
scanf("%d", &input);
current = 0;
while (input--)
{
scanf("%d%d", &startc, &endc);
if (startc <= end && endc >= start)... |
C | #include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
int main(int argc, char **argv)
{
char buf[2];
char file[] = "/tmp/httpXXXXXX";
int filedesc = mkstemp(file);
printf("%s\n", file);
/*int filedesc = open(file, O_RDWR);*/
if(filedesc < 0)
{
return 1;
}
write(filedesc,"Th... |
C | /**********************************************************************************************
Filename: buffer.h
Compiler: Visual Studio Premium 2012
Author: Amaury Diaz Diaz, 040-738-985
Course: CST8152 Compilers, Lab Section: 012
Assignment: Assignment 1 - The B... |
C | #include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <signal.h>
#define ERR_EXIT(m)\
do\
{\
perror(m);\
exit(EXIT_FAILURE);\
}while(0)
int globale = 100;
int main()
{
signal(SIGCHLD,SIG_IGN);... |
C | #if USE_UART
//----------------------------------Инициализация UART----------------------------------
void dataChannelInit(void) //инициализация UART
{
PRR &= ~(0x01 << 1); //включаем питание UART
UBRR0 = (F_CPU / (8UL * UART_BAUND)) - 1; //устанавливаем битрейт
UCSR0A = (0x01 << U2X0); //устанавливаем удвоение с... |
C | #include <stdio.h>
#include <math.h>
int win(char c[]){
if(c[0]==c[1] && c[1]==c[2] && c[0]!='\0')
return 1;
else if(c[3]==c[4] && c[4]==c[5] && c[3]!='\0')
return 1;
else if(c[6]==c[7] && c[7]==c[8] && c[6]!='\0')
return 1;
else if(c[0]==c[3] && c[3]==c[6] ... |
C | /**
* @file board.h
* @author Berki Tamás - PDRE31
* @date 2017. 11. 01.
*/
#ifndef BOARD_H
#define BOARD_H
#define BOARD_BG "\e[0m" ///< A táblában használt háttérszín (fehér)
#define BOARD_FG "\e[0m\e[7m" ///< A táblában használt előtérszín (fekete)
#define BOARD_EMPTY "\e[38;5;252m" ///< Az üres elem előté... |
C | #define __ELEMENT_NODE__
// 这个头文件必须在fifo前,才能使用ElementNode,否则fifo会调用内部自定义的结构体。
typedef struct
{
char * lpBuffer;
int nLoc;
int nSize;
int bUsed;
}MemoryBuffer,*ElementNode;
#include "fifo.h"
#ifndef __MEMORY_H__
#define __MEMORY_H__
// 分配MemoryBuffer内存,释放MemoryBuffer内存
MemoryBuffer * memory_new_d... |
C | #include "csapp.h"
#include "bit.h"
typedef unsigned float_bits;
/* Return the position of leftmost one. The position starts at 1. When x = 0, return 0 */
int leftmost_one_pos(unsigned x) {
int high = 31;
int low = 0;
int middle;
int result;
int length = high - low;
while (length >= 0) {
middle = (low + hig... |
C | #include <stdio.h>
int main()
{
int x;
int one, two, five;
scanf("%d", &x);
for(one=0;one<=x*10;one++)
{
for(two=0;two<=x*5;two++)
{
for(five=0;five<=x*2;five++){
if(one+two*2+five*5==x*10){
printf("%d , %d and %d get %d .\n", one, two, five, x);
break;
}
}
break;
... |
C | #include <stdio.h>
int main()
{
int n;
scanf_s("%d", &n);
if (n < 0)
{
printf(" µ %d Դϴ\n", n);
}
else
{
printf(" µ %d Դϴ\n", n);
}
return 0;
} |
C | /* POINTERS */
// Pointers are very important in C programming because they allow you
// to easily work with memory locations.
// They are fundamental to arrays, strings, and other data structures and
// algorithms.
// A pointer is a variable that contains the address of another variable.
// In other words, it "p... |
C | #ifndef _STRUTIL_H
#define _STRUTIL_H 1
#include <string.h>
#include "banking.h"
int strcmp(const char* a, const char* b);
int strcmpi(const char* a, const char* b);
int str_equals(char* a, char* b);
int indexof(const char* str, int c);
int lindexof(const char* str, int c, int start);
int str_startswith(const char* s... |
C | #include<stdio.h>
#include<math.h>
void hello();
void add();
void subtract();
void Multi();
void div();
void mod();
void cal();
void prime();
void rev1();
void count();
void count1();
void armstrong();
void strong1();
void cuber();
void squarer();
void cube();
void square();
void npow();
void evec... |
C | /*
============================================================================
Name : client.c
Author : Gonzalo Sinnott Segura
Version :
Copyright :
Description : Library client.c
============================================================================
*/
#include <stdio_ext.h>
#include ... |
C | #include<stdio.h>
int is_permutation(long long m, long long n) {
int m_d[10],i;
for(i=0;i<10;i++)
m_d[i] = 0;
while(m!=0) {
m_d[m%10]++;
m=m/10;
}
while(n!=0) {
m_d[n%10]--;
n=n/10;
}
for(i=0;i<10;i++)
if(m_d[i] !=0)
return 1;
return 0;
}
int main() {
char primes[1000000];
long long i,j;
floa... |
C | #include <stdio.h>
int main(int argc, char const *argv[])
{
for (int i = 1; i < 10; i++){
for (int j = i; j > 0; j--){
printf("%i ", j);
}
printf("\n");
}
return 0;
}
|
C | #include "selectsort.h"
#include "qsort.h"
void
selectsort(int data[], int N){
int i, j, tmp, m;
for(i=0;i<N;i++){
tmp = data[i];
m = i;
for(j=i+1;j<N;j++){
if(data[j] < tmp){
tmp = data[j];
m = j;
}
}
swap(data, i, m);
}
} |
C | //#include "Fonctions.h"
#include <stdio.h>
int copierFichier(char const * const, char const * const);
int TmpMain(int argc, char **argv) {
char fichierS[] = "dataTest";
char fichierD[] = "dataTest2.";
copierFichier(fichierS, fichierD);
getchar();
}
int copierFichier(char const * const nomfichierSource, ch... |
C | #include <stdint.h>
#ifndef UTILS_H
#define UTILS_H
/*
To avoid the bug of the compilers
*/
double int2double(signed int i);
typedef struct
{
char *data;
uint32_t front, rear;
uint16_t count, max_size;
} char_queue;
int init_char_queue(char_queue *p, char buf[], uint16_t max_size);
int in_ch... |
C | // 3. Obter o MDC entre dois números inteiros.
#include <stdio.h>
#include <stdlib.h>
int main()
{
int n, n1, m, m1, aux, resto = 1;
printf("Informe n: ");
scanf("%i", &n);
printf("Informe m: ");
scanf("%i", &m);
// Guarda valores iniciais
m1 = m;
n1 = n;
while (resto != 0)
... |
C | //Vallery Salomon
//Lecture 5 Lab 2
//EEGR 409 C Programming Applications
//September 30, 2016
#include <stdio.h>
int main()
{
//Declare Variables
char c;
char c2;
int i = 0;
printf("Enter some text\n");
//Function
do
{
scanf_s("%c", &c);
printf("%c", c);
if (c >= 'a' && c <= 'z') c2 -= 32;
print... |
C | int putchar (int c);
int main () {
int n = 0;
while (n < 26) {
putchar(65 + n);
n = n + 1;
}
return 0;
}
|
C | #include <linux/kernel.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/unistd.h>
#include <linux/init.h>
/*
* For the current (process) structure, we need
* this to know who the current user is.
*/
#include <linux/sched.h>
#include <asm/uaccess.h>
#include <asm/cacheflush.h>
... |
C | #include <stdio.h>
int main()
{
unsigned long long n;
int i;
unsigned long long test;
while(scanf("%llu", &n) != EOF)
{
int count = 0;
for(i = 0;i < 64;i++)
{
test = (n >> i);
if(test & 1)
{
count++;
}
}
printf("%d\n", count);
}
return 0;
} |
C | /*
Scrivere una funzione che dato un array di interi e un
valore x cerca il valore x nell’array. Se il valore x è
presente allora restituirà la posizione altrimenti un codice
di errore 404.
*/
#include <stdio.h>
int find(int* A, int n){
size_t lenght = sizeof(A); //Permette di conoscere il numero di elementi del... |
C | #include <stdio.h>
#include "ll.h"
typedef struct {
uint8_t age;
char name[32];
} person_t;
#define PERSONS_LL_SIZE 16
void print_person(void * person_p){
person_t * person = (person_t *) person_p;
printf("Name: %s, Age: %d\n", person->name, person->age);
}
void print2(ll_t * pll){
ll_node_t * c... |
C | /*
FUNCTION
<<abort>>---abnormal termination of a program
INDEX
abort
SYNOPSIS
#include <stdlib.h>
void abort(void);
DESCRIPTION
Use <<abort>> to signal that your program has detected a condition it
cannot deal with. Normally, <<abort>> ends your program's execution.
In general implementation, <<abort>> raises ... |
C | /*
** EPITECH PROJECT, 2019
** CPool_infinadd_2019
** File description:
** infinadd
*/
#include <unistd.h>
#include <stdlib.h>
#include "./include/my.h"
char *add(char *s1, char *s2)
{
int i = 0, rest = 0, len = 0, lena = my_strlen(s1), lenb = my_strlen(s2);
char *poi = (char *)malloc(len + 1);
if (lena >... |
C | #include <stdio.h>
int main() {
int start = 1;
int end = 100;
int stop = 555;
int sum = 0;
int lastAddition = 0;
for(int i = start; i <= end; i++)
{
sum = sum + i;
lastAddition = i;
if(sum >= stop){
break;
}
else{
continue;
}
}
printf("With max. sum %d, the integers from %d to %d s... |
C | #include "big2.h"
/**
O estado joga_straight é aquele que faz com que o bot jogue um straight. Após todas as validações da sua mão, ele adiciona cartas para jogar, removendo-as da sua mão.
Posto isto, mostra as cartas no tabuleiro, e é a vez de outro jogador.
@param e O estado actual.
@returns O novo estado.
*/
ESTADO... |
C | #include<stdio.h>
#include<stdlib.h>
struct node{
int info;
struct node *next;
};
typedef struct node node1;
void initlist(node1 **list)
{
*list=NULL;
}
void pushdynamic(node1 **list,int x)
{
node1 *l;
l=(node1*)(malloc(sizeof(node1)));
l->info=x;
l->next=*list;
*list=l;
}
void popdynamic(node1 **list... |
C | #include <stdio.h>
#include <stdlib.h>
int main () {
long t, a, b, a2, b2;
scanf("%ld %ld %ld", &t, &a, &b);
a2 = a;
b2 = b;
while (abs(a - b) != t) {
if (a < b) {
a = a + a2;
} else {
b = b + b2;
}
}
if (a < b) {
printf("%ld\n", b);
... |
C | #include "ush.h"
static void sort_vars(char **vars) {
char *temp;
int p = 1;
while (p == 1) {
p = 0;
for (int i = 0; vars[i + 1]; i++) {
if (strcmp(vars[i], vars[i + 1]) > 0) {
temp = vars[i];
vars[i] = vars[i + 1];
vars[i + 1] = temp;
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include "funcoes.h"
#define NUM 20
int main()
{
int i = 0;
int nums[NUM];
int maior = 0;
for( i=0; i < NUM; i++ )
{
printf("Insira um numero [%d/20] \n", i+1);
scanf("%d", &nums[i]);
}
maior ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* dir_utils.c :+: :+: :+: ... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main() {
const char * const str = "hello";
printf("%s\n",str);
char const * ptr = "we";
printf("%s\n",ptr);
ptr = "omg";
printf("%s\n",ptr);
return 0;
}
|
C | // Jeu de la vie avec sauvegarde de quelques itérations
// compiler avec gcc -O3 -march=native (et -fopenmp si OpenMP souhaité)
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <sys/time.h>
#include <mpi.h>
// hauteur et largeur de la matrice
#define HM 1200
#define LM 800
// nombre total d'itératio... |
C | //
// Created by Ming Hu on 4/9/17.
//
#include "weather.h"
char * get_weather_json()
{
// Curl string declaration
curl_string str_buffer;
str_buffer.memory = malloc(1);
str_buffer.size = 0;
// Curl declaration
CURL * curl;
CURLcode curl_response_code;
// Curl init
curl = curl_ea... |
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 | /*************************************************************************
> File Name: fork_path.c
> Author: liyijia
> Mail: liyijiax@163.com
> Created Time: 2019年10月13日 星期日 14时18分44秒
************************************************************************/
#include <stdio.h>
#include <unistd.h>
#include <stdlib... |
C | #include "../header/decoder.h"
#include "../header/matrixMan.h"
#include<stdio.h>
#include<stdlib.h>
void writePPM_P6(const char *filename, struct PPMImage *img) {
FILE *fp;
//open file for output
fp = fopen(filename, "wb");
if (!fp) {
fprintf(stderr, "Unable to open file '%s'\n", filename);
exi... |
C | #include <stdio.h>
#include "RobotArmManager.h"
#include "Action.h"
int main(int argc, char const *argv[])
{
int x,y,z,t;
RobotArmManager* me = RobotArmManager_Create();
x=1;
y=2;
z=3;
t=4;
RobotArmManager_computeTrajectory(me, x, y, z, t);
x=5;
y=6;
z=7;
t=8;
RobotArmM... |
C | #include <stdio.h>
int main(){
printf("\tCalculator\n\n");
while(1){
float num1, num2, total;
int oper;
printf("................\n");
printf("1 for sum\n");
printf("2 for sub\n");
printf("3 for mul\n");
printf("4 for div\n");
printf("5 for exit\n... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.